egrep Command Examples

Find patterns in files using extended regular expression (supports ?, +, {}, () and |). More information: https://manned.org/egrep.

egrep "{{search_pattern}}" {{path/to/file}}

egrep "{{search_pattern}}" {{path/to/file1 path/to/file2 ...}}

cat {{path/to/file}} | egrep {{search_pattern}}

egrep --with-filename --line-number "{{search_pattern}}" {{path/to/file}}

egrep --recursive --binary-files={{without-match}} "{{search_pattern}}" {{path/to/directory}}

egrep --invert-match "{{search_pattern}}" {{path/to/file}}