In grep
I understand there is a -B
switch that will...
Print NUM lines of leading context before matching lines.
... so for example you might run a command like:
cvs log -N -S -w<userid> -d"1 day ago" | grep -B14 "some text" > afile
Is there an equivalent to this in Windows? What I've currently got is:
cvs log -N -S -w<userid> -d"1 day ago" | find "7492" > output.txt
But this only pipes the text on the same line as 7492
in the output, whereas I need some of the preceding lines to usefully interpret the information. But as far as I can see the find
command doesn't have a switch equivalent to the -B
switch of grep
. Is there some way of replicating this aspect of grep functionality in Windows?