1
0
Fork 0
mirror of https://github.com/tldr-pages/tldr.git synced 2025-04-29 01:44:57 +02:00

Merge pull request #925 from tldr-pages/grep

grep.md: "something" → "search_string"; -r → -rI
This commit is contained in:
Leandro Ostera 2016-06-24 11:35:07 +02:00 committed by GitHub
commit e7ca2819f0

View file

@ -5,15 +5,15 @@
- Search for an exact string: - Search for an exact string:
`grep {{something}} {{file_path}}` `grep {{search_string}} {{file_path}}`
- Search in case-insensitive mode: - Search in case-insensitive mode:
`grep -i {{something}} {{path/to/file}}` `grep -i {{search_string}} {{path/to/file}}`
- Search recursively in current directory for an exact string: - Search recursively (ignoring non-text files) in current directory for an exact string:
`grep -r {{something}} .` `grep -rI {{search_string}} .`
- Use a regular expression (`-E` for extended regex, supporting `?`, `+`, `{}`, `()` and `|`): - Use a regular expression (`-E` for extended regex, supporting `?`, `+`, `{}`, `()` and `|`):
@ -21,24 +21,24 @@
- Print 3 lines of context around each match: - Print 3 lines of context around each match:
`grep -C 3 {{something}} {{path/to/file}}` `grep -C 3 {{search_string}} {{path/to/file}}`
- Print the count of matches instead of the matching text: - Print the count of matches instead of the matching text:
`grep -c {{something}} {{path/to/file}}` `grep -c {{search_string}} {{path/to/file}}`
- Print line number for each match: - Print line number for each match:
`grep -n {{something}} {{path/to/file}}` `grep -n {{search_string}} {{path/to/file}}`
- Print file names with matches: - Print file names with matches:
`grep -rl {{something}} .` `grep -rl {{search_string}} .`
- Use the standard input instead of a file: - Use the standard input instead of a file:
`cat {{path/to/file}} | grep {{something}}` `cat {{path/to/file}} | grep {{search_string}}`
- Invert match for excluding specific strings: - Invert match for excluding specific strings:
`grep -v {{something}}` `grep -v {{search_string}}`