Quote:
Originally Posted by ideasman
Hi, Im running a build bot that generates colored output to the console using console escape sequences (ECMA-48 Im told), when these logs are redirected to a file they are ofcourse not colored, the text looks like this...
Code:
header_script.c:165: warning: unused variable ‘script’
|
The problem is how to get an usable output. If there's no way to get a clean output for color codes, then at most you can design something to parse the log files, search for those strings and substitute them with usable color codes (might it be html tags, might it be ANSI codes to display it under a shell).
For example, if you store the log line you posted into a file called "test", then this should print it using colors:
Code:
echo -e $(cat test | sed -e 's/‘/\\033[95m/' -e 's/’/\\033[0m/')
You would need to design a sed script for all the colors I guess, but it should be quite trivial. The same trick should work for html tags if that's what you want.
I guess this script changes ANSI to HTML, but whatever the output of your bot is, it is not ANSI compatible. So, you need to design your own parser. It should be quite trivial in either python or bash/sed, but I think that the best option would be to modify the original bot to use an ANSI compatible output. That would eliminate the need for any external stuff, and it should be easily doable.