Remove text between headers while leaving headers intact

Hi,
I'm trying to strip all lines between two headers in a file:

### BEGIN ###

[Header 1]
Text to remove, contains all kinds of characters
...
Antispyware-Downloadserver.com (Germany)=http://www.antispyware-downloadserver.c
om/updates/
Antispyware-Downloadserver.com #2 (Germany)=http://www.antispyware-downloadserve
r.com/updates/
ComputerFixerTools.com (USA)=http://67.202.99.48/spybot/
Evertje Networks (Europe)=http://sbsd.mirror.evertjenetworks.nl/files/updates/
FastSpeedTest.com (USA)=FastSpeedTest.com - Test your Internet Speed and find out how to speed it up!
...

[Header 2]
More stuff, more headers

### END ###

I've tried several different sed commands, and the results have been either nothing is removed, or the line [Header 2] is removed as well.

Sorry, I haven't saved a list of what I've tried; here is my most recent failed attempt though:

sed -e '/\[Header\ 1\]/,/\[Header\ 2\]/ { /^\[Header\ 2\]$/!d }

Any help would be appreciated, and thank you in advance =)

Hi,

i am not sure, if i understand you correctly, but if you
try to delete everything from "[Header 1]" to "[Header 2]" not
including "[Header 2]", this will do it:

sed '/[[]Header 1]/,/[[]Header 2]/{/Header 2/!d}' file

HTH Chris

Awesome! Worked like a charm; now I've just got to read up on sed syntax to understand exactly how it works =)

Thank you for your quick reply!

This should give you all the info you need:

http://www.catonmat.net/blog/sed-one-liners-explained-part-one/
http://www.catonmat.net/blog/sed-one-liners-explained-part-two/
sed '/[[]Header 1]/,/[[]Header 2]/{/Header 2/!d}' file

means: search for the text between [Header 1] and [Header 2]. The
construct [[] is used to escape the "[" character. If "Header 1"
and "Header 2" are found, delete everything except the line containg
the string Header 2.