egrep — stdin  stdout  - file  -- opt  --help  --version


egrep [options] pattern [files]

The egrep command is just like grep, but uses a different (“extended”) language for regular expressions. It’s the same as grep -E.

Table 1-2. Regular expressions for grep and egrep

Regular expression





Any single character.


Match any single character in this list.


Match any single character NOT in this list.







Beginning of a line.


End of a line.


Beginning of a word.


End of a word.


Any alphanumeric character.


Any alphabetic character.


Any control character.


Any digit.


Any graphic character.


Any lowercase letter.


Any printable character.


Any punctuation mark.


Any whitespace character.


Any uppercase letter.


Any hexadecimal digit.


Zero or more repetitions of a regular expression.



One or more repetitions of a regular expression.



Zero or one occurrence of a regular expression.

\{n \}

{n }

Exactly n repetitions of a regular expression.

\{ n ,\}

{n ,}

n or more repetitions of a regular expression.

\{ n , m \}

{ n , m }

Between n and m (inclusive) repetitions of a regular expression, n < m.


The character c literally, even if c is a special regular expression character. For example, ...

Get Linux Pocket Guide, 2nd Edition now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.