I have a text file like
Hi
how are you
<blank>
<blank>
abcd
<blank>
defgh
opqr
<blank>
I want to print all lines that have the pattern like “some text”blankblank”some text”
like
how are you
<blank>
<blank>
abcd
I am thinking about using join and then search for the pattern. But I am not sure how to do it. (By blank I mean empty line)
/^(?:(?!\n)\s)*\n/m/^.*\S.*\n/mSo you want to print all instances of:
As a lone liner:
If all your blank lines contain no whitespace, you can simplify some:
/^\n/m/^.+\n/m