add grep
This commit is contained in:
12
linux/grep.md
Normal file
12
linux/grep.md
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
# 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"`
|
||||||
Reference in New Issue
Block a user