From 4ddf91c3729b42e17ff7ba2adf54e880470c3735 Mon Sep 17 00:00:00 2001 From: Antoine Amara Date: Mon, 4 Oct 2021 16:03:50 +0200 Subject: [PATCH] egrep: add page (#6737) --- pages/common/egrep.md | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 pages/common/egrep.md diff --git a/pages/common/egrep.md b/pages/common/egrep.md new file mode 100644 index 0000000000..ae589f5760 --- /dev/null +++ b/pages/common/egrep.md @@ -0,0 +1,28 @@ +# egrep + +> Find patterns in files using extended regular expression (supports `?`, `+`, `{}`, `()` and `|`). +> More information: . + +- 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}}`