0
awk 'BEGIN { COLM_FMT = "%-8s, %-8s, %-8s, %-8s, %-8s, %-8s, %-8s, %-8s, %-8s, %-8s, %-8s, %-8s, %-8s, %-8s,\n" }
{ printf COLM_FMT, ${totals[0]}, ${totals[1]}, ${totals[2]}, ${totals[3]}, ${totals[4]}, ${totals[5]}, ${totals[6]}, ${totals[7]},
${totals[8]}, ${totals[9]}, ${totals[10]}, ${totals[11]}, ${totals[12] }'
Why is the above awk statement giving me the following errors:
'awk: syntax error near line 2' 'awk: illegal statement near line2'
This is within a bash script.
Is the
awk
statement as shown, with theprintf
statement split over two lines (which are lines 2 and 3)? If so, try putting a backslash at the end of line 2 (the first line of theprintf
). – Scott – 2013-11-08T23:25:29.103