Team LiB   Previous Section   Next Section

Chapter 13. The gawk Scripting Language

gawk is the GNU version of awk, a powerful pattern-matching program for processing text files that may be composed of fixed- or variable-length records separated by some delineator (by default, a newline character). gawk may be used from the command line or in gawk scripts. You should normally be able to invoke this utility using either awk or gawk on the shell command line.

With gawk, you can:

  • Conveniently process a text file as though it were made up of records and fields in a textual database.

  • Use variables to change those records and fields.

  • Execute shell commands from a script.

  • Perform arithmetic and string operations.

  • Use programming constructs such as loops and conditionals.

  • Define your own functions.

  • Process the result of shell commands.

  • Produce formatted reports.

For more information on gawk, see sed & awk (O'Reilly) or Effective gawk Programming (O'Reilly).

    Team LiB   Previous Section   Next Section