O'Reilly logo

Linux Shells by Example by Ellie Quigley

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

3.2. Extended grep (grep -E or egrep)

The main advantage of using extended grep is that additional regular expression metacharacters (see Table 3.4) have been added to the basic set. With the -E extension, Gnu grep allows the use of these new metacharacters.

Table 3.5. egrep's Regular Expression Metacharacters
Metacharacter Function Example What It Matches
^ Beginning of line anchor ^love Matches all lines beginning with love.
$ End of line anchor love$ Matches all lines ending with love.
. Matches one character l..e Matches lines containing an l, followed by two characters, followed by an e.
* Matches zero or more characters *love Matches lines with zero or more spaces, of the preceding characters followed by the pattern love.
[ ] Matches one ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required