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

need output with certain field

Status
Not open for further replies.

frankli

Technical User
Joined
Apr 6, 2005
Messages
44
Location
CA
hi I want to get the output only for 2nd field is "partition", can somebody point out what I did wrong? thanks.

[root@box1 tmp]# /sbin/swapon -s
Filename Type Size Used Priority
/dev/sda2 partition 16779884 0 -1
/addswap file 20482943 0 -2

I did

/sbin/swapon -s | awk '/$2=="partition"/ {print $3}'

but no output.

Regards!
 
/sbin/swapon -s | awk '$2=="partition" {print $3}'

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ222-2244
 
Aha! yes! thanks PH.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top