Print lines that match extended regular expression patterns.
Synopsis
egrep [OPTION]... PATTERN [FILE]...
Description
Equivalent to grep -E: search for PATTERN, treated as an extended regular expression, in each FILE. With no FILE, or when FILE is -, read standard input. Runs in the just-bash WASM shell inside SLICC.
Options
-i, --ignore-case Ignore case distinctions.
-v, --invert-match Select non-matching lines.
-w, --word-regexp Match only whole words.
-x, --line-regexp Match only whole lines.
-c, --count Print only a count of matching lines.
-l, --files-with-matches Print only names of files with matches.
-n, --line-number Print line number with output lines.
-r, -R, --recursive Search directories recursively.
-A NUM / -B NUM / -C NUM Context lines after/before/around matches.
Examples
$ egrep 'foo|bar' file.txt
Search for either 'foo' or 'bar'.
$ egrep -c '^[0-9]+$' data.txt
Count lines that are entirely digits.
Notes
Identical to grep -E in this shell. See grep --help for the full option list.
See Also
grep, fgrep, rg, sed