I'm in need of some assistance with using the highlight feature in bash.
My goal is to grep three parameters and then highlight them with three different colors. I've been messing around with this but can't wrap my mind around how to do this.
I've tried
Input:
user@syslog:~$ grep --color=always Dwhite VPNsyslog-2016 | grep --color date | grep --color time
Output:
the results only highlighted Dwhite
and time for some reason date did not get highlighted. all of them highlighted in red.
I've also tried
user@syslog:~$ GREP_COLORS='mt=01;32' grep Dwhite VPNsyslog-2016| GREP_COLORS='mt=01;31' grep date VPNsyslog-2016 | GREP_COLORS='mt=01;34' time VPNsyslog-2016
output:
Nothing.
Please excuse me if the syntax is all jacked up. I'm very new to this and I'm not a programmer. I'm just a network admin trying to make looking at the syslog easy on the eyes.
--line-buffered
in the intermediate greps, otherwise you'll see the output in batches.tail -f somefile.log | grep --line-buffered --color=always Dwhite | grep …
– Gilles 'SO- stop being evil' Mar 08 '16 at 19:22