Unix Power ToolsUnix Power ToolsSearch this book

20.11. Versions of awk

awk was introduced as part of Unix's seventh edition and has been part of the standard distribution ever since.

In 1985, the authors of awk extended the language, adding many useful features. Unfortunately, this new version remained inside AT&T for several years. It became a regular part of AT&T's System V as of Release 3.1. It can be found under the name of nawk (for "new awk"); the older version still exists under its original name.

Figure Go to http://examples.oreilly.com/upt3 for more information on: gawk

Unfortunately, nawk is not available on all systems. The good news is that the Free Software Foundation GNU project's version of awk, called gawk, implements all the features of the new awk.

In general, you can assume that what is true for nawk is true for gawk, unless gawk is explicitly called out. Scripts written for nawk are 100 percent compatible with gawk. If you want to use one of the nawk scripts and don't have nawk on your system, simply change the script to invoke gawk instead.

There are a few areas where gawk has introduced gawk-specific features; however, recent versions of nawk support many of these features, suggesting that the remaining differences are really very minor. This shouldn't matter in any case, since we do supply gawk on the disc.

This book doesn't cover any of the awks in detail. The recent awks, especially, have quite a few features in common -- so documentation for any one of them should help you learn the others.

In this book, we show scripts for awk as well as scripts that work only on nawk and gawk. But we barely scratch the surface of all the awks' features. The completely revised second edition of O'Reilly & Associates' sed & awk has detailed information on all of them.[58] There's also lots of documentation on the CD-ROM [see http://examples.oreilly.com/upt3]. Take your pick.

[58]And thanks to Arnold Robbins, coauthor of the second edition, for his help with this section and other awk material in this book.

--JP and DD, TOR



Library Navigation Links

Copyright © 2003 O'Reilly & Associates. All rights reserved.