I got this in a file:
\033[31mException log
And when I do:
less -R demo
I get no colors:
What am I doing wrong?
I got this in a file:
\033[31mException log
And when I do:
less -R demo
I get no colors:
What am I doing wrong?
You need to put the actual escape code in the file. One way to do this would be:
echo -e "\033[31mException log\033[0m" > file.txt
Then less -R file.txt should be able to interpret the color code.
These characters are not a colour code sequence, but they are the sequence to tell some tools/programming-languages to create the desired character sequence.
e.g.
echo -e "\033[31mException log"
Test that your terminal actually supports the colours by running:
cat your_file.txt
If your file has colour codes, your terminal will show them. If not, then either 1) your term isn't configured to support it or 2) you've entered incorrect codes.