Subject: nawk strange behavior with regex in FS
To: None <netbsd-users@NetBSD.org>
From: None <tlaronde@polynum.com>
List: netbsd-users
Date: 07/01/2005 15:10:16
Hello,

I'm on NetBSD 2.0.2 (i386).

Whether nawk(1) is behaving strangely or there is something that I
definitively don't understand with awk when giving a regex for FS.

Using gawk(1), I have the behavior I expect.
nawk(1) doesn't handle correctly (on my installation at least) FS:

Script started on Thu Jun 30 21:50:35 2005
jordan% awk 'BEGIN { FS = " *: *"; } { print $1 "|" $2; }'
1:2
1|2
1:21
1|2
1 :add
1|a
1a:bdd
1a|
1a :bdd
1a|
1a :2dd
1a|
jordan% gawk 'BEGIN { FS = " *: *"; } { print $1 "|" $2; }'
1:2
1|2
1:21
1|21
1 :add
1|add
1a:bdd
1a|bdd
1a :bdd
1a|bdd
1a :2dd
1a|2dd
jordan% exit

Script done on Thu Jun 30 21:53:02 2005

Am I making something completely stupid? Is someone seeing this very
same behavior? Setting debug level shows that nawk is accepting the 
correct NF, but the count on characters is definitively wrong (ISTR that
there were notes in the sources about collapsing sequences and i18n
causing problems, but this is just a memory).

If anybody can confirm/infirm and gives some clue.

TIA
-- 
Thierry Laronde (Alceste) <tlaronde +AT+ polynum +dot+ com>
http://www.kergis.org/  |  http://www.kergis.com/
Key fingerprint = 0FF7 E906 FBAF FE95 FD89  250D 52B1 AE95 6006 F40C