Search

egrep

Search for extended regular expression patterns (equivalent to grep -E).

Synopsis

syntax
egrep [OPTION]... PATTERN [FILE]...

Examples

Match multiple patterns with alternation
egrep '(error|warning|critical)' log.txt
Find import statements recursively
egrep -rn '^import .+ from' src/
Match phone number patterns
egrep '[0-9]{3}-[0-9]{4}' contacts.txt

Common options

FlagDescription
-iCase-insensitive
-rRecursive search
-nShow line numbers
-vInvert match
-cCount matches

About egrep

The `egrep` command search for extended regular expression patterns (equivalent to grep -E). Search commands help you locate files, text patterns, and executables across the filesystem.

Efficient searching is critical when working with large codebases or troubleshooting system issues. These tools range from simple filename lookups to full regular-expression pattern matching across file contents.

The command accepts 5 commonly used flags shown above, though the full set of options is available in the man page (`man egrep`). The 3 examples on this page cover typical real-world usage patterns that you can copy and adapt for your own workflows.

Related commands

More Search Commands

Other commands in the Search category

Related tools