I'd like to point out that very little of the trouble in the above had to do with sed
itself, per se, but with the regular expressions
used in the matching. I recommend that Holering take a little time to learn how to use at least the basics of regex more effectively.
Here are a few regular expressions tutorials: