Please use ***
[code][/code] tags*** around your code and data, to preserve formatting and to improve readability. Please do
not use quote tags, bolding, colors, or other fancy formatting.
Vague descriptions mean people have to make guesses and assumptions, which leads to vague or unhelpful answers. If you'd provide an actual example of input text, and show us what needs to be matched/extracted/changed/whatever, maybe we could provide better solutions.
sed isn't a particularly good multi-line editor, and perhaps
awk or another tool would end up being more suitable.