Deleting Doubled Block with sed or awk

hi there,

i have a text file like that one:

I like to delete the second block with the Start and End Line!

Does anyone have a idea?

Thanks for your help,

Roland

What have you attempted so far and where do you get stuck?

Regards

At the momentan i have realized it with

But the lines are very correct.

Than I tried

but it just prints that thing I want to delete. Hmmm
And it doesn't test about the dublicity! :frowning:

Perhaps someone could help me out!

Roland

If Perl is acceptable, you may try something like this:

perl -0777pe'
  s|(Start.*?End)|$x{$1}++?$/:$1|sge
  ' infile

You can do something like that :

awk '(/^Start/ && ++s==2),/^End/ { next } 1 '  inputfile

Inputfile:

blablabla
blub
bla
Start 1111 blabla
111 texttexttext
111 texttexttext
111 texttexttext
End 1111 blabla

Start 2222 blabla
222 texttexttext
222 texttexttext
222 texttexttext
End 222 blabla
blablabla
blub
bla 
Start 3333 blabla
333 texttexttext
333 texttexttext
333 texttexttext
End 333 blabla
bla

Output:

blablabla
blub
bla
Start 1111 blabla
111 texttexttext
111 texttexttext
111 texttexttext
End 1111 blabla

blablabla
blub
bla 
Start 3333 blabla
333 texttexttext
333 texttexttext
333 texttexttext
End 333 blabla
bla

Jean-Pierre.