I have a XML file that looks something like this:
<Header version= '1.0' timestamp='2017-01-04T07:10:07'>
<Date>2017-04-18</Date>
.
.
.`
</Header>
<Header version= '1.0' timestamp='2017-01-04T07:10:07'>
<Date>2017-04-18</Date>
.
.
.`
</Header>
<Header version= '1.0' timestamp='2017-01-04T07:10:07'>
<Date>2017-04-18</Date>
.
.
.`
</Header>
I would like to delete the "Header" (and not /Header) lines starting with the 2nd occurrence - don't ask why :-). So the output should look something like this (yes, I know that it is not well formed, but I am going to perform other processing on it as well):
<Header version= '1.0' timestamp='2017-01-04T07:10:07'>
<Date>2017-04-18</Date>
.
.
.`
</Header>
<Date>2017-04-18</Date>
.
.
.`
</Header>
<Date>2017-04-18</Date>
.
.
.`
</Header>
I tried:
sed -i '2,${/<Header/d;}' file
but that deleted all the occurrences of Header. Any suggestions?
Thanks