sed remove ansi colors from output

Using ansi colors can be very helpful to see script out[put. Example of cleaning ansi color codes from output before putting it in your log. You may want to keep them since cat would still handle it. However if you don't like your logs with unreadable codes this is an example of cleaning it first with sed.

# crontab -l
00 22 * * * /root/scripts/ -w 1 -t | sed -r "s/\x1B\[([0-9]{1,2}(;[0-9]{1,2})?)?[mGK]//g" > "/logs//bin/date +\%Y-\%m-\%d-backup-"


Bio Info for Riaan