diff --git a/linux/grep.md b/linux/grep.md new file mode 100644 index 0000000..0c32b04 --- /dev/null +++ b/linux/grep.md @@ -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"` \ No newline at end of file