From owner-freebsd-stable@FreeBSD.ORG Sun Oct 3 20:42:22 2010 Return-Path: Delivered-To: freebsd-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 72D911065673 for ; Sun, 3 Oct 2010 20:42:22 +0000 (UTC) (envelope-from poyopoyo@puripuri.plala.or.jp) Received: from msa04a.plala.or.jp (msa04.plala.or.jp [58.93.240.4]) by mx1.freebsd.org (Postfix) with ESMTP id D6C4C8FC1B for ; Sun, 3 Oct 2010 20:42:21 +0000 (UTC) Received: from i125-202-0-194.s02.a026.ap.plala.or.jp ([125.202.0.194]) by msa03b.plala.or.jp with ESMTP id <20101003203151.IITG19691.msa03b.plala.or.jp@i125-202-0-194.s02.a026.ap.plala.or.jp> for ; Mon, 4 Oct 2010 05:31:51 +0900 Date: Mon, 04 Oct 2010 05:31:50 +0900 Message-ID: <8662xjdnm1.wl%poyopoyo@puripuri.plala.or.jp> From: poyopoyo@puripuri.plala.or.jp To: freebsd-stable In-Reply-To: References: <4CA78EE3.9020005@quip.cz> <4CA82024.8010503@bsdforen.de> Mail-Followup-To: =?ISO-2022-JP-2?B?Um91YhskKEQrPystGyhCZWsgWmRlbg==?= =?ISO-2022-JP-2?B?GyQoRCs1GyhCaw==?= , freebsd-stable User-Agent: Wanderlust/2.15.9 (Almost Unreal) SEMI/1.14.6 (Maruoka) FLIM/1.14.9 (=?ISO-2022-JP-2?B?R29qGyQoRCtXGyhC?=) APEL/10.8 Emacs/23.2 (amd64-portbld-freebsd9.0) MULE/6.0 (HANACHIRUSATO) MIME-Version: 1.0 (generated by SEMI 1.14.6 - "Maruoka") Content-Type: text/plain; charset=ISO-2022-JP-2 X-VirusScan: Outbound; msa03b; Mon, 4 Oct 2010 05:31:51 +0900 Subject: Re: is there a bug in AWK on 6.x and 7.x (fixed in 8.x)? X-BeenThere: freebsd-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Production branch of FreeBSD source code List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 03 Oct 2010 20:42:22 -0000 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