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 {{[-H|--with-filename]}} {{[-n|--line-number]}} "{{search_pattern}}" {{path/to/file}}

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

egrep {{[-v|--invert-match]}} "{{search_pattern}}" {{path/to/file}}