I really tried searching but could not find anything (it's hard to know what exactly to search for).
I know how to do this with sed
: print from current line until the line that matches SOMETHING:
sed -n '/1/,/SOMETHING/p'
But how do I do the same thing, but print from current line until the line that does not match SOMETHING?
e.g. pipe this into sed
:
blah blah SOMETHING blah blah
blah blah SOMETHINGblahblahblah
SOMETHING blah blah
NO MATCH HERE
Then I want to filter out and print only the first 3 lines (but "3" can vary).