I'm running an expect script that's calling several scripts on a remote machine. Those shell scripts return color output (mostly red and green). The problem is, that those color codes make it into the log_file and STDOUT, which I don't want. I can't modify the remote scripts.
I tried sed, where I pipe the output from expect through sed which removes the color codes. The problem is, that the expect script is run by the Webmin "custom commands" module, which has issues with the piped output. I also tried to call the remote scripts using a sed pipe inside the expect script, but this creates other issues.
Is there a way to remove color codes from STDOUT and log_file directly in expect with something built in?