From owner-freebsd-questions@FreeBSD.ORG Mon Jan 19 00:10:50 2004 Return-Path: Delivered-To: freebsd-questions@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 8C5CE16A4CE for ; Mon, 19 Jan 2004 00:10:50 -0800 (PST) Received: from zim.0x7e.net (zim.0x7e.net [203.38.184.132]) by mx1.FreeBSD.org (Postfix) with ESMTP id E5EA243D1D for ; Mon, 19 Jan 2004 00:10:48 -0800 (PST) (envelope-from listone@deathbeforedecaf.net) Received: from goo.0x7e.net ([203.38.184.164] helo=goo) by zim.0x7e.net with smtp (Exim 3.36 #1) id 1AiUUa-00061I-00; Mon, 19 Jan 2004 18:40:40 +1030 Message-ID: <006d01c3de63$b9e29a30$a4b826cb@goo> From: "Rob" To: "David Fleck" References: <20040118030911.GA18161@tao.thought.org><20040117215110.R602@grond.sourballs.org><007d01c3dd7d$d0917530$a4b826cb@goo> <20040118074234.J602@grond.sourballs.org> Date: Mon, 19 Jan 2004 18:40:38 +1030 MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit X-Priority: 3 X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook Express 6.00.2800.1158 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165 cc: Gary Kline cc: David Fleck cc: FreeBSD Mailing List Subject: Re: awk vs. nawk [Was: stumped... .] X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 19 Jan 2004 08:10:50 -0000 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'. 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.