Summary
This chapter explained regular expressions, and two common tools that use them under Linux: grep
and sed
.
We began by explaining that regular expressions are search patterns, used in combination with text to find matches. These search patterns allow us to search very flexibly in text where its contents are not necessarily known at runtime.
Search patterns allow us, for example, to look only for words and not numbers, for words at the beginnings or endings of lines, or for empty lines. Search patterns include wildcards, which can represent one or more of a certain character or character class.
We introduced the grep
 command to show how we can use the basic functionality of regular expressions in Bash.
The second part of this chapter dealt with globbing. Globbing is used as a wildcard mechanism for file names and paths. It has similarities with regular expressions, but also some key differences. Globbing can be used with most commands that deal with files (and, since most things under...