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!

including a variable inside awk script 2

Status
Not open for further replies.

fejjalh

Programmer
Mar 12, 2004
1
FR
In fact, I want to print the second column of different files where the first column contains the name of these files.
The command is
awk '$1==file1' {print $2++} file1
Well Iwant to do this for many files by replacing file1 with a variable item $filename.
Thank you.
 

This should do it:

Code:
$1==FILENAME{print $2}

Let me know whether or not this helps.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top