Date: Mon, 04 Oct 2010 05:31:50 +0900 From: poyopoyo@puripuri.plala.or.jp To: freebsd-stable <freebsd-stable@freebsd.org> Subject: Re: is there a bug in AWK on 6.x and 7.x (fixed in 8.x)? Message-ID: <8662xjdnm1.wl%poyopoyo@puripuri.plala.or.jp> In-Reply-To: <D9FBB57B75131949A71B706EB2074498BDF94F88@SRVPPE02.t-systems.cz> References: <4CA78EE3.9020005@quip.cz> <4CA82024.8010503@bsdforen.de>
next in thread | previous in thread | raw e-mail | index | archive | help
At Sun, 3 Oct 2010 15:09:35 +0200, Roub$(D+?+-(Bek Zden$(D+5(Bk wrote: > >> awk 'FS="," { print $1"-"$2 }' GeoIPCountryWhois.csv This code is equivalent to awk '(FS=","){} { print $1"-"$2 }' GeoIPCountryWhois.csv so I think it is OK not to separate the first line with ",". However, from the latest one-true-awk/FIXES source we have in src/contrib, | Nov 26, 2009: | fixed a long-standing issue with when FS takes effect. a | change to FS is now noticed immediately for subsequent splits. AWK seems intentionally changed this behaviour. When FS has been changed, working line is immediately re-parsed with new FS. This explains why 8.x awk print *intended* $1"-"$2 though older and GNU ones do not. > I met the very same problem some time ago, not a bug, feature. > > http://www.mail-archive.com/freebsd-questions@freebsd.org/msg55958.html > > Still, one interesting question remains, why 8.x behaves in a different way then the previous versions. Now both are their own feature. Conclusion: avoid ambiguous code as far as it could. -- kuro
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?8662xjdnm1.wl%poyopoyo>