I'm using grep in a search that returns significant false-positivies, and it's probably easier for me to identify the good results by inspection, than to write the much more complicated grep expression.
To do that, I need to see more than 1 line for each result.
Can I (How do i) instruct grep to return 1-2 lines above and below each match?
If you have GNU grep
, then:
grep -A 2 -B 2
or grep -C 2
-A
stands for after-B
stands for before-C
stands for context (both before and after)
Source and more options: http://unixhelp.ed.ac.uk/CGI/man-cgi?grep
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With