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-questi...@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
_______________________________________________
freebsd-stable@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-stable
To unsubscribe, send any mail to "freebsd-stable-unsubscr...@freebsd.org"

Reply via email to