Is there a way, either with
grep or something else, to (in effect) combine
grep -v and
grep -A? That is, rather than include everything for x lines after a string, exclude everything.
Quick reminder for those who forget their grep switches:
cat file.txt | grep -v blah filters out 'blah', the opposite of normal grep
cat file.txt | grep -A7 foo will display 7 lines after each occurance of 'foo'
(Yes I'm aware that
cat is unnecessary here. But I find it much more readable when you string together a lot of
grep statements to do it this way.)
cat file.txt | grep -A100 bar | grep -vA100 foo
will not work. "Working" would be defined as displaying everything (up to 100 lines) between the line matching 'bar' and the line matching 'foo'.