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

cat piping awk: filename as variable

Status
Not open for further replies.

ergy

Technical User
Sep 16, 2009
4
DE
Hey,

I have the following for-loop:

Bash:
for i in 0_bla_*
do
        cat $i |awk -v filename=$filename '{if (NR>11) {anz=anz+1}}END{printf("%3$s %1$s %2$s \n", NR-1, anz, filename)}' > $i.dat
done

I want to pipe the filename from cat to awk. But it doesn't work. Has anyone an idea?

Thanks for any help,
Ergy
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top