Hi.
I give you no extra magic, however, a rule that works for me is to remember that
sed deals with single-lines unless you do some extra work.
I could not get the URL that Nick posted to work (
page deleted ). If you can read Russian, perhaps some of the links at that top page might help.
There are some other places to look. The web page
http://sed.sourceforge.net/ has a number of links that may help.
It is difficult to imagine a better reference than O'Reilly's
sed and awk. I use the 2nd edition (page 107 ff for your circumstance); you might be able to pick up a used version someplace of either edition 1 or 2. I think sed is very useful in many situations, however,
perl has probably taken over much of the new work for which sed had been used.
Best wishes ... cheers, makyo