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 gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Manipulating columns in awk

Status
Not open for further replies.

fcolassie

Technical User
Dec 12, 2003
12
NL
Hi,

I have just started to learn awk and I am alreadt facing a problem. I have to following columns:
0 0 0 22.32
15 0 0 16.2
75 0 0 18.48
140 0 0 17.94
180 0 0 16.72
240 0 0 18
300 0 0 16.8
360 0 0 16.79
420 0 0 19.58
480 0 0 19.53

How can I extract only rows for which column 1 equals 15 and 75?
Thanks in advance
 
dickiebird, your command extract too much lines (155 for exemple)

awk '$1 ~ /^(15|75)$/' yourfile > newfile
or
awk '$1 == 15 || $1 == 75' yourfile > newfile

Jean Pierre.
 
Ooops - missed out the space !
awk '/^15 |^75 /' yourfile > newfile


Dickie Bird (:)-)))
 
Thanx guys. I used the && instead of || option.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top