< Day Day Up > |
awk is a pattern-matching program for processing files, especially when each line has a simple field-oriented layout. The new version of awk, called nawk, provides additional capabilities.[*] Every modern Unix system comes with a version of new awk, and its use is recommended over old awk. The GNU version of awk, called gawk, implements new awk and provides a number of additional features.
Different systems vary in what new and old awk are called. Some have oawk and awk, for the old and new versions, respectively. Others have awk and nawk. Still others only have awk, which is the new version. This example shows what happens if your awk is the old one: $ awk 1 /dev/null awk: syntax error near line 1 awk: bailing out near line 1 awk will exit silently if it is the new version. The POSIX standard for awk is based on new awk, and the standard uses the simple designation awk for that language. Thus, we do also. If your system's awk is the old one, find the new one, and use it for your programs.
Items described here as "common extensions" are often available in different versions of new awk, as well as in gawk, but should not be used if strict portability of your programs is important to you. The freely available versions of awk described in the section "Source Code," later in this chapter, all implement new awk. With awk, you can:
In addition, with GNU awk (gawk), you can:
|
< Day Day Up > |