grep.md: "something" → "search_string"; -r → -rI

waldyrious/alt-syntax
Waldir Pimenta 2016-06-23 18:50:38 +01:00 committed by GitHub
parent d1b3b357e8
commit a2b596861d
1 changed files with 10 additions and 10 deletions

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}}`