How to grep from before/after/current lines that match given regex or keyword
Grep ABC –after/before/current
How to get 1(n) lines before the line that matches given regex
cat sample.txt | grep -B1 "four"
How to get 1(n) lines after the line that matches given regex
cat sample.txt | grep -A1 "four"
How to get 1(n) lines from current line that matches given regex
cat sample.txt | grep -C1 "four"
#grep -ABC
#grepbeforeline
#grepafterline
#grepfromcurrent line
...
https://www.youtube.com/watch?v=wbjCxkErjbo