Subject: awk(1) RE in FS debacle?
To: None <tech-userlevel@NetBSD.org>
From: None <tlaronde@polynum.com>
List: tech-userlevel
Date: 07/02/2005 12:02:58
Hello,
I have first tried to report on users' lists just to see if there was a
problem on my installations or if this was indeed seen everywhere. Since
it seems that there is nothing special with my installations, it is a
non POSIX compliance problem, hence the copy to the list.
Here is the original message on netbsd-users :
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
--
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