Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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 was marked as an exact duplicate of an existing question.

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.