1
0
Fork 0
mirror of https://github.com/tldr-pages/tldr.git synced 2025-07-24 08:55:33 +02:00

egrep: add page (#6737)

This commit is contained in:
Antoine Amara 2021-10-04 16:03:50 +02:00 committed by GitHub
parent d3b4517498
commit 4ddf91c372
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

28
pages/common/egrep.md Normal file
View file

@ -0,0 +1,28 @@
# 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}} {{path/to/file3}}`
- 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}}`