David Fleck asked on Mon Jan 19, 2004:

> What does 'nawk' do that 'awk' doesn't?  I've got both binaries on my
> system, but the nawk manpage is just a link to awk(1).

I believe that awk is the GNU version while nawk is the (rewritten) Bell
Labs original:

  > awk --version
  GNU Awk 3.0.6
  Copyright (C) 1989, 1991-2000 Free Software Foundation.

  [...snip...]

  > nawk -V
  awk version 20020210

You can see the code for both of them under /usr/src/contrib:

  > ls -ld /usr/src/contrib/*awk
  drwxr-xr-x  6 root  wheel  1024 Jul 12  2003 /usr/src/contrib/awk
  drwxr-xr-x  2 root  wheel   512 Jul 12  2003 /usr/src/contrib/one-true-awk

My subjective opinion is that [g]awk has more features but nawk is more
'standard'.

<off-topic>

I got into the habit of using nawk on Solaris, because Solaris awk is very
basic and a bit flaky. On that platform, nawk supports extended regexes and
has many more functions; it is also more reliable and has better error
checking. I read somewhere that A, W & K never intended awk to be used for
programs of any size, and when they realised this was happening they gave it
a major rewrite - 'new awk' was the result.

The Solaris manpage says

     nawk is a new version of awk that provides capabilities
     unavailable in previous versions. This version will become
     the default version of awk in the next major release.

but they've been saying that for at least 5 major releases.

</off-topic>

_______________________________________________
[EMAIL PROTECTED] mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to "[EMAIL PROTECTED]"

Reply via email to