First, please use code tags around the file contents; not around the contents AND the descriptions of the contents.
Second, are you saying that your input files contain code to change font and color; or is that just something you added to confuse us? Do we really have to parse the font and color changes within these lines so we not only copy changes to text but also possible changes to font, color, boldness, and italicization?
Third, you say that comment lines are to be ignored, but instead of ignoring them in the output, you add a space to the start of comment lines??? What do you mean by ignore: Do not change comment lines, or delete comment lines?
Fourth why would you limit us to using sed for this? Your specification of what is supposed to happen is ambiguous, but it seems that awk would be a much better tool for this job.
Are you saying that your input files contain code to change font and color; or is that just something you added to confuse us? Do we really have to parse the font and color changes within these lines so we not only copy changes to text but also possible changes to font, color, boldness, and italicization?
What do you mean by ignore comment lines?
Why would you limit us to using sed for this? Your specification of what is supposed to happen is ambiguous, but it seems that awk would be a much better tool for this job.