3
I know how to use grep to output a line that matches a string. But what if I also want to output one line above every line containing a matching string, how do I do that?
3
I know how to use grep to output a line that matches a string. But what if I also want to output one line above every line containing a matching string, how do I do that?
5
do the following
grep -B 1 text_to_search_for file.txt
2That should be a -B right? – tony_sid – 2010-08-08T00:06:26.987
Sorry, yes. -B for Before. -C is for before and after. Corrected answer, I had misread the question – bryan – 2010-08-08T00:18:49.430