From 862b8b2fb0628d80d07fabe6c72af745a03de26c Mon Sep 17 00:00:00 2001 From: Jonathan Agmon Date: Fri, 1 May 2026 23:44:02 +0300 Subject: [PATCH] add grep --- linux/grep.md | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100644 linux/grep.md 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