mirror of https://github.com/CrimsonTome/tldr.git
various tweaks to grep
- use "case-insensitive" in the description of the -i option to make the initialism clear - use path/to/file instead of file_path - mention extended regex syntax and expand first occurrence to spell "regular expression" - clarify wording of the -C example descriptionwaldyrious/alt-syntax
parent
5841b530e7
commit
7782d92820
|
@ -7,33 +7,33 @@
|
||||||
|
|
||||||
`grep {{something}} {{file_path}}`
|
`grep {{something}} {{file_path}}`
|
||||||
|
|
||||||
- Search without case-sensitivity:
|
- Search in case-insensitive mode:
|
||||||
|
|
||||||
`grep -i {{something}} {{file_path}}`
|
`grep -i {{something}} {{path/to/file}}`
|
||||||
|
|
||||||
- Search recursively in current directory for an exact string:
|
- Search recursively in current directory for an exact string:
|
||||||
|
|
||||||
`grep -r {{something}} .`
|
`grep -r {{something}} .`
|
||||||
|
|
||||||
- Use a regex:
|
- Use a regular expression (`-E` for extended regex, supporting `?`, `+`, `{`, `|`, `(`, and `)`):
|
||||||
|
|
||||||
`grep -e {{^regex$}} {{file_path}}`
|
`grep -e {{^regex$}} {{path/to/file}}`
|
||||||
|
|
||||||
- See 3 lines of context:
|
- Print 3 lines of context around each match:
|
||||||
|
|
||||||
`grep -C 3 {{something}} {{file_path}}`
|
`grep -C 3 {{something}} {{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}} {{file_path}}`
|
`grep -c {{something}} {{path/to/file}}`
|
||||||
|
|
||||||
- Print line number for each match:
|
- Print line number for each match:
|
||||||
|
|
||||||
`grep -n {{something}} {{file_path}}`
|
`grep -n {{something}} {{path/to/file}}`
|
||||||
|
|
||||||
- Use the standard input instead of a file:
|
- Use the standard input instead of a file:
|
||||||
|
|
||||||
`cat {{file_path}} | grep {{something}}`
|
`cat {{path/to/file}} | grep {{something}}`
|
||||||
|
|
||||||
- Invert match for excluding specific strings:
|
- Invert match for excluding specific strings:
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue