[Bug 1329736] Re: When specifying a field separator with {FS=", "}, the separator is not applied to the first line

Greg Lutostanski 1329736 at bugs.launchpad.net
Fri Jun 13 14:51:47 UTC 2014


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!

** Changed in: mawk (Ubuntu)
       Status: New => Won't Fix

-- 
You received this bug notification because you are a member of Ubuntu
Server Team, which is subscribed to mawk in Ubuntu.
https://bugs.launchpad.net/bugs/1329736

Title:
  When specifying a field separator with {FS=","}, the separator is not
  applied to the first line

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/mawk/+bug/1329736/+subscriptions



More information about the Ubuntu-server-bugs mailing list