Name

awk

Synopsis

    awk [options] [program] [var=value ...] [files]

Use the pattern-matching program to process the specified files. program instructions have the general form:

pattern { procedure }

pattern and procedure are optional. When specified on the command line, program must be enclosed in single quotes to prevent the shell from interpreting its special symbols.

Two versions of awk exist: the original, “old” awk from V7 Unix, circa 1979, and “new” awk, from System V Release 4. POSIX awk is based on the new one.

On most systems, awk is a POSIX-compliant version, except on Solaris, where you must use /usr/xpg4/bin/awk instead of /usr/bin/awk. Some systems provide oawk and nawk commands as well. See Chapter 11 for more information (including examples) on awk.

Get Unix in a Nutshell, 4th Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.