bug-gnu-utils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Oddity in regular expressions


From: Paul Eggert
Subject: Re: Oddity in regular expressions
Date: Sun, 22 Apr 2001 00:59:29 -0700 (PDT)

> Date: Wed, 18 Apr 2001 15:56:10 +0300
> From: Aharon Robbins <address@hidden>
> 
> I got an interpretation request into the POSIX cycle in time for
> the next (and last?) recirculation draft,

Wow, that draft was published only a few hours before you sent your
email!  On retrieving it I see that the normative wording was changed
as you describe -- though the rationale was not changed, and is
therefore incorrect now.

> (And before anyone asks, gawk 3.1 has hit code and documentation freeze.
> I'm not changing this for 3.1.)

Not even to document the compatibility problem?  I think it'd be worth
mentioning in the 3.1 documentation how gawk's behavior differs from
other awks, and how it is likely to change in gawk 3.2 to conform to
the draft standard.  That might help users avoid problems in this area.

For example, the 3.1 documentation could include this little example
showing the difference between the various awks on Solaris 8:

$ echo abc | /usr/xpg4/bin/awk '{sub(/b/, "\\n\\&\\\\&\\\\\\\\&"); print}'
an&\b\\bc
$ echo abc | mawk '{sub(/b/, "\\n\\&\\\\&\\\\\\\\&"); print}'
a\n&\b\\bc
$ echo abc | gawk '{sub(/b/, "\\n\\&\\\\&\\\\\\\\&"); print}'
a\n&\b\\&c
$ echo abc | nawk '{sub(/b/, "\\n\\&\\\\&\\\\\\\\&"); print}'
a\n&\&\\\&c

This is gawk 3.0.5 (the version that Sun ships in /opt/sfw/bin/gawk)
and mawk 1.3.3 as compiled by me.  /usr/xpg4/bin/awk is Sun's attempt
to write a POSIX.2-1992 awk.  nawk is the AT&T or Bell Labs awk
(sorry, I don't know which).  Of these implementations, only mawk
conforms to the latest POSIX draft.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]