mirror of
https://github.com/tldr-pages/tldr.git
synced 2025-04-29 23:24:55 +02:00

* pages*: remove = from GNU-style long options * 7z: readd needed = * 7za: add missing = * 7zr: fix argument and option separation * astyle: readd missing = * aws-ecr: readd missing = * az-devops: readd missing = * csslint: readd missing = * cs-fetch: readd missing = * bzgrep: readd missing = * chromium: readd missing = * docker-commit: remove unnecessary = * docker-system: remove unnecessary = * docker-ps: remove unnecessary = * dockerd: remove unnecessary = * 7za: readd missing = * 7zr: readd missing = * chromium.de: readd missing = * chromium.de: readd missing = * bundletool: remove additional space Co-authored-by: Nicolas Kosinski <nicokosi@users.noreply.github.com> --------- Co-authored-by: Sebastiaan Speck <12570668+sebastiaanspeck@users.noreply.github.com> Co-authored-by: Nicolas Kosinski <nicokosi@users.noreply.github.com>
1.3 KiB
1.3 KiB
grep
Find patterns in files using regular expressions. More information: https://www.gnu.org/software/grep/manual/grep.html.
- Search for a pattern within a file:
grep "{{search_pattern}}" {{path/to/file}}
- Search for an exact string (disables regular expressions):
grep --fixed-strings "{{exact_string}}" {{path/to/file}}
- Search for a pattern in all files recursively in a directory, showing line numbers of matches, ignoring binary files:
grep --recursive --line-number --binary-files {{without-match}} "{{search_pattern}}" {{path/to/directory}}
- Use extended regular expressions (supports
?
,+
,{}
,()
and|
), in case-insensitive mode:
grep --extended-regexp --ignore-case "{{search_pattern}}" {{path/to/file}}
- Print 3 lines of context around, before, or after each match:
grep --{{context|before-context|after-context}} {{3}} "{{search_pattern}}" {{path/to/file}}
- Print file name and line number for each match with color output:
grep --with-filename --line-number --color=always "{{search_pattern}}" {{path/to/file}}
- Search for lines matching a pattern, printing only the matched text:
grep --only-matching "{{search_pattern}}" {{path/to/file}}
- Search
stdin
for lines that do not match a pattern:
cat {{path/to/file}} | grep --invert-match "{{search_pattern}}"