Subject: Re: README: nawk vs. gawk
To: None <>
From: Greg A. Woods <>
List: current-users
Date: 02/01/2001 18:01:21
[ On Thursday, February 1, 2001 at 10:17:20 (-0500), Todd Vierling wrote: ]
> Subject: Re: README: nawk vs. gawk
> Could we look into the feasibility of implementing at least some of the
> GNUisms that aren't implemented by nawk?  (Say, does nawk implement $10 and
> up, etc.?)

Ah, even "old V7 awk" did that!  Maybe the MINIX one didn't, but all others do:

	$ uname -srm
	SunOS 5.6 sun4m
	$ ls -l /usr/bin/oawk
	-r-xr-xr-x   2 bin      bin        84560 Jul 16  1997 /usr/bin/oawk
	$ ls -l /usr/bin/nawk
	-r-xr-xr-x   1 bin      bin       125756 Jul 16  1997 /usr/bin/nawk
	$ echo one two three four five six seven eight nine ten eleven twelve \
	> thirteen fourteen fifteen sixteen seventeen eighteen nineteen twenty \
	> twentyone twentytwo twentythree twentyfour twentyfive | oawk '{print $25}'

(the other link to 'oawk' on SunOS-5.6 is, surprisingly, still 'awk'!)

As far as I know The One True Awk has been POSIX compatible since at
least 1997 (though it seems to have a couple of minor extensions too).

It should not be necessary for NetBSD Awk to go beyond POSIX.

> Awk is used by more than just NetBSD-supplied software; it's a favorite for
> sysadmin-created scripts.  When we do switch, if we don't emulate the
> GNUisms, we have to make a VERY LOUD message about it in the release notes.

Having hacked ton's of awk, both my own and other people's, I can
confidently say that it's almost always incredibly portable (unless you
only have a V7 implementation, but *nobody* is that badly off any
more!).  I was quite stunned by even the minor bugs that were in the
pkgsrc/mk stuff.  People who have used only GNU Awk might be worse
offenders, but it's hard to stray from the POSIX Awk specification even
with GNU Awk, and of course you can trivially check your programs by
using '--posix'.  Mawk carefully documents its differences with POSIX
Awk, as does GNU Awk, though unfortunately The One True Awk does not.

							Greg A. Woods

+1 416 218-0098      VE3TCP      <>      <robohack!woods>
Planix, Inc. <>; Secrets of the Weird <>