Comment 2 for bug 1329736

Revision history for this message
Greg Lutostanski (lutostag) wrote :

Thanks for reporting this bug and taking the time to help make Ubuntu better!

Unfortunately what you are experiencing is a quirk of how awk works [of which there are many :)]. Field separators are only used for the next line after they are set. To get around this you can use the BEGIN pattern to do this before the first line is read into the awk interpreter -- example given below.

awk 'BEGIN {FS=","} {print $2","$5","$14","$17","$20","$23","$26","$29","$32","$35","$77","$78","$79","$80","$81","$82","$83","$84","$85","$86","$87","$88","$89","$90","$91","$92","$93","$94","$95","$96","$97","$98}'

I tested against mawk as well as busybox's awk which both do the same thing. While this is nonintuitive, it is expected behavior.

I am marking this bug as "won't fix", please comment if you believe I am mistaken.

Thanks again!