How to pass a variable to an awk print parameter...
Posted
by Jamie
on Stack Overflow
See other posts from Stack Overflow
or by Jamie
Published on 2010-06-15T18:37:14Z
Indexed on
2010/06/15
18:42 UTC
Read the original article
Hit count: 223
I'm trying extract the nth + 1
and nth + 3
columns from a file.
This is what tried, which is a useful pseudo code:
for i in {1..100} ; do awk -F "," " { printf \"%3d, %12.3f, %12.3f\\n\", \$1, \$($i+1), \$($i+3) } " All_Runs.csv > Run-$i.csv
which, obviously doesn't work (but it seemed reasonable to hope).
How can I do this?
© Stack Overflow or respective owner