UNIX and the awk text processor tool

According to Greg Goebel's Public Domain pages, the awk text-processing language is useful for such tasks as:

  • Tallying information from text files and creating reports from the results.
  • Adding additional functions to text editors like "vi".
  • Translating files from one format to another.
  • Creating small databases.
  • Performing mathematical operations on files of numeric data.
  • Translating files from one format to another.

awk has two faces

  1. it is a utility for performing simple text-processing tasks, and
  2. it is a programming language for performing complex text-processing tasks.

More specifically, The GNU awk User's Guide notes that:

The basic function of awk is to search files for lines (or other units of text) that contain certain patterns. When a line matches one of the patterns, awk performs specified actions on that line. awk keeps processing input lines in this way until it reaches the end of the input files.

As with Vi, we won't spend too much time becoming awk "experts", but we will look at how to use UNIX to get into it.

If you want more try ITS's Help page: UNIX: Data Management.

If you use a Mac, you may wish to download an awk "cheatsheet" program.

[top]