Possible Duplicate:
Removing control chars (including console codes / colours) from script output

Is there a utility which uncolors colored output? Something like the uncolor utility in the example below:

$ ./colored_output | uncolor > plain.txt

The aim is to remove characters like "[0m[32m" and "[0m[1m" which get additionally output.


You should try

./colored_output |
    sed -r "s/\x1B\[([0-9]{1,3}((;[0-9]{1,3})*)?)?[m|K]//g" > plain.txt

Not the answer you're looking for? Browse other questions tagged or ask your own question.