I am currently using the following command to use the standard ANSI colors with the tail command:
tail -f syslogfile | sed -e 's/\(.*MAJOR.*\)/\o033[93m\1\o033[39m/'
This is bright yellow however I am just getting into extended 256 colors in bash and I would like to use the color orange. I have found the correct foreground and background color numbering scheme to give me orange on black.
echo -e "\\033[40;5;95;38;5;202mhello world\\033[0m"
However I am having trouble translating this into a sed command that I can use with the tail command.
I have tried this:
sed -e 's/\(.*MAJOR.*\)/\033[40;5;95;38;5;202\033[0m/'
But that leaves everything white. I have tried:
sed -e 's/\(.*MAJOR.*\)/\o033[40;5;95;38;5;202\o033[0m/'
But this blacks out the lines that contain the string "MAJOR". I have also tried leaving out the background scheme and just going with the orange :
sed -e 's/\(.*MAJOR.*\)/\033[38;5;202\033[0m/'
But this also seems to black out the lines that contain the word "MAJOR" Does anyone know what the correct ANSI sequence would be for sed to give me orange on black? FYI the sed command I used in my first example prints the entire line in the color chosen and I would need the same behavior with the new color sequence, not just coloring the word itself.
sed -e 's/\(.*MINOR.*\)/\o033[38;5;202m\1\o033[40;5;95m/'
But leaves other lines that do not contain MINOR colored magenta. How do I get those to default back to white. Am I not turning something off correctly? It's actually making default font color for the entire shell magenta, as I can see when I terminate the tail command.