I have a text file like so:
<!--START OF FILE -->
random text
<meta> more random text </meta>
x x x x x x x
more random text
that I dont need
x x x x x x x
I need everything
from this point
onwards
...
I need to remove everything between <!--START OF FILE -->
and the second
x x x x x x x
like so:
I need everything
from this point
onwards
...
I tried using sed '/<!--START OF FILE -->/,/x x x x x x x/d' test.txt
but this removes the block between the first occurence of x x x x x x x
which is not what I want.
Best Answer
This is quite the opposite of
How to print lines between pattern1 and 2nd match of pattern2?
With
sed
you'd do something like:or, in one line (on
gnu
setups):Sure, it's easier with
awk
and counters. I'll leave that as an exercise for you...