diff --git a/pages/common/grep.md b/pages/common/grep.md index 6307dadd5..1127b43e6 100644 --- a/pages/common/grep.md +++ b/pages/common/grep.md @@ -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}}`