Grep command
Original Message
Name: nimi
Date: July 10, 2007 at 20:57:23 Pacific
Subject: Grep commandOS: N/ACPU/Ram: N/AModel/Manufacturer: N/A
Comment: Hi
SITE MCC MNC LAC CI ELEMENT VALUE --- 11 502 12 4021 (0FB5h) 14336 (3800h) 0 11 502 12 4021 (0FB5h) 14337 (3801h) 0 11 502 12 4021 (0FB5h) 14338 (3802h) 0
How to grep the 0 value from the file. This 0 value is actually the last column after the Element Value header.
I used grep "ELEMENT VALUE" abc.log but how do i go to the next row.
Thanks
Nimi
Report Offensive Message For Removal
Response Number 2
Name: nimi
Date: July 11, 2007 at 00:58:38 Pacific
Subject: Grep command
Reply: (edit )Thanks, that didnt really work.
How to awk/script this:- Extract column 8 from row = 48 of file.txt and store in variable.
11 502 12 4021 (0FB5h) 14336 (3800h) 0
Nimi
Report Offensive Follow Up For Removal
Response Number 4
Name: ghostdog
Date: July 11, 2007 at 06:51:47 Pacific
Subject: Grep command
Reply: (edit )why it did not work? show what you have done. to get row 48, use NR==48. To get column 8 , use $8. If you are sure that the "0" is always at last field, then you can use $NF.
Report Offensive Follow Up For Removal
Response Number 5
Name: Nirmala
Date: July 11, 2007 at 18:25:31 Pacific
Subject: Grep command
Reply: (edit )To get the result I did this:-
grep -n "ELEMENT VALUE" file.txt > out.txt EXT_LINE=`awk 'BEGIN {FS=":"} {print $1;}' file.txt` NEW_LINE=`expr $EXT_LINE + 2` awk 'BEGIN {FS=" "} NR==48 { print $8 }' "input.log"
Report Offensive Follow Up For Removal
Use following form to reply to current message: