I think you are looking for a kind of sed script that will surround the words that you select with the ANSI Color escape sequences. (hmm ... lemme look).
EDIT OK, it turned out:
Here is an example of the output of "Hello" in dark red:
echo -e "\033[31mHello\033[0m"
What's happening? First of all, I use echo -e so that echo does not convert slashes to screen slashes, but rather reads the \033 escape sequence as a single escaped character. Actually it is only 33 octal, which is 27 (serial number of the ESC key).
So what really gets sent to the screen is something like:
<ESC>[32mHello<ESC>[0m
Which ANSI screen is interpreted as "first run the 32m command, print" Hello ", and then run the 0m command.
In this case, the 32m command means “set the background color to 2”, and since color No. 2 is dark red, the “feather” used by the terminal will now be dark red. This means that from now on all the text that will be displayed on the screen will be dark red.
When we finish the output of the text, which should be red, we want to reset the color, so we call the 0m command, which resets the colors to normal.
For a list of all escape codes, search in [ http://en.wikipedia.org/wiki/ANSI_escape_code Wikipedia] or just go to Google.
So all you need to do a sed script is to replace the words you have chosen with words surrounded by colors. For example, to replace the word "Feb" in /var/log/messages , follow these steps:
tail /var/log/messages | sed -e "s/Feb/\\o033[31m&\\o033[0m/"
(You may need to do this as root to actually read /var/log/messages )
All sed did was search for the word “Feb” and its surroundings with the same escape sequence as we used above.
You can expand it to color a few words:
tail /var/log/messages | sed -e "s/\(Feb\|Mar\|Apr\)/\\o033[31m&\\o033[0m/g"
What will be the color of "Feb", "Mar", "Apr" - each in dark red.
Hope this gives you some insight into how to do what you need!