Computing.Net > Forums > Unix > Grep command

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.

Grep command

Reply to Message Icon

Name: nimi
Date: July 10, 2007 at 20:57:23 Pacific
OS: N/A
CPU/Ram: N/A
Product: 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



Sponsored Link
Ads by Google

Response Number 1
Name: ghostdog
Date: July 11, 2007 at 00:39:43 Pacific
Reply:

[code]
awk '
NR>1{ print $NF }
' "file"
[/code]


0

Response Number 2
Name: nimi
Date: July 11, 2007 at 00:58:38 Pacific
Reply:

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


0

Response Number 3
Name: nimi
Date: July 11, 2007 at 00:59:23 Pacific
Reply:

and space delimited

Nimi


0

Response Number 4
Name: ghostdog
Date: July 11, 2007 at 06:51:47 Pacific
Reply:

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.


0

Response Number 5
Name: Nirmala
Date: July 11, 2007 at 18:25:31 Pacific
Reply:

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"



0

Related Posts

See More



Sponsored Link
Ads by Google
Reply to Message Icon

need script help Prob Assign Row count to ...



Post Locked

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.


Go to Unix Forum Home


Sponsored links

Ads by Google


Results for: Grep command

grep command www.computing.net/answers/unix/grep-command/6034.html

Help on grep command www.computing.net/answers/unix/help-on-grep-command/7376.html

can I use grep command?? www.computing.net/answers/unix/can-i-use-grep-command/7156.html