To get colored output from standard commands like grep, you should set this alias in your .bashrc
# User specific aliases and functions
alias grep='grep --color=auto'
when you grep something in your file you see something like this, (but probably in red):
[root@linuxbox mydir]# grep "\(INFO\|SEVERE\)" /var/log/logname
this entry is an INFO
SEVERE this entry is a warn!
this entry is an INFO
this entry is an INFO
SEVERE this entry is a warn!
if want to use tail or awk and want that the color survive to a pipe, then the alias is not enough and you should use the --color=always parameter, for example:
[root@linubox mydir]# grep --color=always "\(INFO\|SEVERE\)" /var/log/logname | tail -f | awk '{ print $1 }'
this
SEVERE
this
this
SEVERE
If you want color text with awk the story is a little bit complex but more powerfull, for example:
[root@linubox mydir]# tail -f /var/log/messages | awk '{if ($5 ~ /INFO/) print "\033[1;32m"$0"\033[0m"; else if ($1 ~ /SEVERE/) print "\033[1;31m"$0"\033[0m"; else print $0}'
this entry is an INFO
SEVERE this entry is a warn!
this is another ENTRY
this entry is an INFO
this is another ENTRY
this entry is an INFO
SEVERE this entry is a warn!
with each line in its own color.
There are many other way to get colorized text from shell with other tools and they are well descripted by other members.