6

I am running Ansible on multiple machines and redirecting the output to a file, say log-$(date), which is mailed to me every day. The output file has multiple text colors, how to turn them off? Sendmail sends output which contains [0;32m, [0;33m, [0;36m, etc.

Is there an option in sendmail? Or in Ansible settings? (I don't want to turn it off in Ansible.)

dhag
  • 15,440
  • 4
  • 54
  • 65
Sandjaie Ravi
  • 945
  • 1
  • 8
  • 12

1 Answers1

8

Ask the program that produces those colors to stop, or remove those colors yourself:

sed "s,\x1B\[[0-9;]*[a-zA-Z],,g"

^I have this in an executable named uncolor so that I can do:

aProgramThatWontStopColoring | uncolor
Petr Skocik
  • 28,176
  • 14
  • 81
  • 141