Sometimes when we use | tee output.txt
to obtain the logs of a command, we obtain unformatted logs due to the colors used by libraries such as logger
In order to fix this, you can use the sed
tool to remove color escape sequences from the output.txt
output file. You can do this with the following command:
cat output.txt | sed "s/\x1B\[[0-9;]*[mK]//g" > formatted_output.tx