Chapter 7. Pattern Matching

A number of Unix text-processing utilities let you search for, and in some cases change, text patterns rather than fixed strings. These utilities include the editing programs ed, ex, vi, and sed, the awk programming language, and the commands grep and egrep. Text patterns (called regular expressions in the computer science literature) contain normal characters mixed with special characters (called metacharacters ).

This chapter presents the following topics:

  • Filenames versus patterns

  • Description of metacharacters

  • List of metacharacters available to each program

  • Examples

For more information on regular expressions, see Mastering Regular Expressions, listed in the Bibliography.

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.