Back to the command reference

egrep

ShellFundamentals In simulator In real Linux

grep with extended regexps (same as grep -E)

Name: egrep = extended grep

You can practise it right away in the simulator, and use it in real Linux mode too.

Description

egrep is grep -E: extended regular expressions where |, +, ? and {n} work without backslashes. Recent GNU grep warns that it is obsolescent; write grep -E instead.

Syntax

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

Examples

  • $ egrep "ERROR|WARN" app.log

    Match ERROR or WARN

    Explain
  • $ grep -E "[0-9]{3}" file.txt

    The preferred modern form

    Explain

Related