Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

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.

share|improve this question

marked as duplicate by warl0ck, sr_, Mat, Renan, cjm Sep 30 '12 at 16:42

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

1 Answer 1

You should try

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

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