1
0
Fork 0
mirror of https://github.com/tldr-pages/tldr.git synced 2025-04-23 05:22:11 +02:00
tldr/pages/common/egrep.md
Reinhart Previano Koentjoro 1a7645ceb2
egrep, grep: use serial comma, add Indonesian translations (#15494)
* egrep, grep: use serial comma, add Indonesian translations

* grep: reverse Spanish fixes

* grep: revert fixes for Romance languages (Dutch, French, Portuguese)

* grep: revert fixes for Romance languages (German)
2025-01-14 22:56:32 +01:00

865 B

egrep

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

  • Search for a pattern within a file:

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

  • Search for a pattern within multiple files:

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

  • Search stdin for a pattern:

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

  • Print file name and line number for each match:

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

  • Search for a pattern in all files recursively in a directory, ignoring binary files:

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

  • Search for lines that do not match a pattern:

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