Possible Duplicate:
Removing control chars (including console codes / colours) from script output
I'm working on a script to work alongside a program that I'm writing. What i'm trying to do is assess the level of completion of a number of clients using another script. My script does pretty much exactly as I want, but there are some color constants that are inserted into my XML output, which mess things up when I'm parsing the XML into PHP later. long story short, I have a sed expression that I'm using which removes the first portion of the color constants, but it fails to remove the trailing escape sequence which looks something like ^[(B - thus my problem.
Here is the sed sequence I'm using:
sed -r 's/\x1B\[([0-9]{1,3}((;[0-9]{1,3})*)?)?[m|K]//g'
I'm wondering if there is a separate sed sequence I could run afterwards to remove the trailing sequence. I've tried using
sed 's/\^\[\\(B//'
But it doesn't seem to remove anything. I don't necessarily need an answer, if someone has a good guide on sed and color codes, that would also be super helpful. I've googled around, but the answers I've found just seem to remove the opening portion of the color.
Thanks for your help.