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!

Pull out word 1

Status
Not open for further replies.

smicro

MIS
Dec 26, 2002
281
US
Have a file that one line reads

848844 retyor toyoyih W=9099 eoeoe

One of the lines will always contain W=
I can grep for W= but it pulls out the entire line, how do I grep for this to just pull out W=9099
The columns and position of W= are changing constantly, tired using awk.

 
Something like this (I didn't test it however)?

awk '/W=/ {
for (i=1;i<=NF;i++)
{
if ($i~/W=/)
print $i
}
exit
}' /path/to/inputfile



HTH,

p5wizard
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top