1

adding one more column in a loop

view story
linux-howto

http://www.unix.com – Code: data1 1 0.01 3 5 1 0.6  2 1   data2 2 0.02 3 5 2 0.3 2 1   data3 3 0.01 3 5 3 0.01 2 1   output   1 0.01 data1 2 0.02 data2 3 0.01 data3 3 0.01 data3 I want to print 1st, 2nd column and the filename when second column is less than 5. I have tried Code: for i in data1 data2 data3 gawk '{if ($2 < 0.05) print $1, $2, ${i}}' > ${i} done   cat data1 data2 data3 > output but i dont think ${i} part works. any idea? (HowTos)