I didn't find the exact similar question, so i need to ask:
I have a file gist :
...
must_be_intact
bad_line
bad_line
bad_line
match_line
...
I use awk to remove everything before the match but after a space:
'NR==FNR{if (/match_line/) {
i=0;
while(1) {
if (NR-i==/^\s*$/) break;
del[NR-i];
i=i-1;
next
}
}
} !(FNR in del)'
But this does not work correctly. Help improve this code, or you can advise another way.