Chapter 6. The GNU awk programming language

Table of Contents
6.1. Getting started with gawk
6.1.1. What is gawk?
6.1.2. Gawk commands
6.2. The print program
6.2.1. Printing selected fields
6.2.2. Formatting fields
6.2.3. The print command and regular expressions
6.2.4. Special patterns
6.2.5. Gawk scripts
6.3. Gawk variables
6.3.1. The input field separator
6.3.2. The output separators
6.3.3. The number of records
6.3.4. User defined variables
6.3.5. More examples
6.3.6. The printf program
6.4. Summary
6.5. Exercises

In this chapter we will discuss:

  • What is gawk?

  • Using gawk commands on the command line

  • How to format text with gawk

  • How gawk uses regular expressions

  • Gawk in scripts

  • Gawk and variables

NoteTo make it more fun

As with sed, entire books have been written about various versions of awk. This introduction is far from complete and is only intended for understanding examples in the following chapters. For more information, best start with the documentation that comes with GNU awk: "GAWK: Effective AWK Programming: A User's Guide for GNU Awk".