IT for operating businesses

Using the egrep Command

Find patterns in files using extended `regex`es. Note: This command is an alias of `grep --extended-regexp`. See also: `regex`. More information: <https://manned.org/egrep>.

  • Search for one or more repeated characters:

egrep '*a*+' *path/to/file*

  • Search for zero or one occurrences of a character (optional match):

egrep '*a*?' *path/to/file*

  • Search for 10 repetitions of a character:

egrep '*a*{10}' *path/to/file*

  • Search for 3 to 7 repetitions of a character:

egrep '*a*{3,7}' *path/to/file*

  • Search for one of the listed options:

egrep '*cat*|*dog*|*mouse*' *path/to/file*

  • Search for one of the listed options inside a larger pattern:

egrep 'c(*a*|*o*|*u*)p' *path/to/file*

  • Search for a group of characters repeating one or more times:

egrep '(*aeiou*)+' *path/to/file*

egrep [[*:alnum:|:alpha:|:space:|...*]] *path/to/file*


This content is compiled from the open-source tldr-pages project under the MIT license.