Merge pull request #925 from tldr-pages/grep

grep.md: "something" → "search_string"; -r → -rI
waldyrious/alt-syntax
Leandro Ostera 2016-06-24 11:35:07 +02:00 committed by GitHub
commit e7ca2819f0
1 changed files with 10 additions and 10 deletions

View File

@ -5,15 +5,15 @@
- Search for an exact string:
`grep {{something}} {{file_path}}`
`grep {{search_string}} {{file_path}}`
- 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 `|`):
@ -21,24 +21,24 @@
- 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:
`grep -c {{something}} {{path/to/file}}`
`grep -c {{search_string}} {{path/to/file}}`
- Print line number for each match:
`grep -n {{something}} {{path/to/file}}`
`grep -n {{search_string}} {{path/to/file}}`
- Print file names with matches:
`grep -rl {{something}} .`
`grep -rl {{search_string}} .`
- 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:
`grep -v {{something}}`
`grep -v {{search_string}}`