A number of UNIX text-editing 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 scripting language, and
This section presents the following topics:
Metacharacters used in pattern matching are different from metacharacters used for filename expansion (see Sections 4 and 5). When you issue a command on the command line, special characters are seen first by the shell, then by the program; therefore, unquoted metacharacters are interpreted by the shell for filename expansion. The command:
could, for example, be interpreted by the shell as:
and would then try to find the pattern
Double quotes suffice in most cases, but single quotes are the safest bet.
(Note also that in pattern matching,