Chapter 7. Introducing regular expressions
As you become more familiar with UNIX or LINUX, there is one subject you will bump into repeatedly, and that is regular expressions. As you use the shell, the need to extract more than just a basic string from a file soon outgrows it. For example, you may want to extract a word where the first two characters are, say, upper case followed by four numbers. You cannot do this in the shell unless you use some form of regular expression.
In this chapter we will cover:
matching at the beginning and end of line;
matching sets of data;
matching only alpha or numeric or both; and
matching character ranges.
When we want to extract or filter text from a file or an output of a command we can use what is called regular ...