12 lines
333 B
Markdown
12 lines
333 B
Markdown
# Useful grep arguments
|
|
## Search without case sensitivity
|
|
`cat file.txt | grep -i "pattern"`
|
|
## Add lines to match pattern
|
|
### Before
|
|
`cat file.txt | grep -B 3 "pattern"`
|
|
### After
|
|
`cat file.txt | grep -A 3 "pattern"`
|
|
### Both
|
|
`cat file.txt | grep -C 3 "pattern"`
|
|
## Show line numbers with matches
|
|
`cat file.txt | grep -n "pattern"` |