[SATLUG] awk - do I have to manually insert the field delimiter when printing?

Don Davis dondavis at reglue.org
Wed Apr 24 14:01:27 CDT 2013


Quick question:

When rearranging columns with awk (where the delimiter is a comma):

Can I have awk automatically insert the delimiter ( a comma) using a
format such as this:

cat somefile |awk -F',' '{print $1 $2 $7 $8 $9 $ 10 $11 $3 $4 $5 $6}'

or do I have to manually specify it:

awk -F',' '{print $1 "," $2 "," $7 "," $8 "," $9 ","  $10 "," $11 "," $3
"," $4 "," $5 "," $6}'


?

Thanks,

Don


More information about the SATLUG mailing list