Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

parsing file

Status
Not open for further replies.

oblucb

Technical User
Jun 26, 2002
2
US
I have a file that I want to parse by the value of the last characters in the last field.

Specifically, I want to grab all lines where the last characters of the line (there are five fields) are either "1" or "1.5".

For a file like:
... 0
... 0
... 0.5
... 0.5
... 1 (take)
... 1.5 (take)
... 2
...
... 10.5
... 11 (take)
... 11.5 (take)
...

Thanks
 
I know this is the awk forum , but this sounds like a job for egrep.

egrep "1$|0.5$" file
 
My OS required single quotes, but yes. This works perfectly.
Thanks.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top