1 | # grep
|
2 |
|
3 | > Matches patterns in input text
|
4 | > Supports simple patterns and regular expressions
|
5 |
|
6 | - search for an exact string
|
7 |
|
8 | `grep {{something}} {{file_path}}`
|
9 |
|
10 | - search recursively in current directory for an exact string
|
11 |
|
12 | `grep -r {{something}} .`
|
13 |
|
14 | - use a regex
|
15 |
|
16 | `grep -e {{^regex$}} {{file_path}}`
|
17 |
|
18 | - see 3 lines of context
|
19 |
|
20 | `grep -C 3 {{something}} {{file_path}}`
|
21 |
|
22 | - print the number of matches
|
23 |
|
24 | `grep -c {{something}} {{file_path}}`
|
25 |
|
26 | - use the standard input instead of a file
|
27 |
|
28 | `cat {{file_path}} | grep {{something}}`
|