[ALUG] Program to tail and highlight

(Ted Harding) Ted.Harding at manchester.ac.uk
Thu Jun 18 14:54:09 BST 2009


On 18-Jun-09 13:25:05, David Reynolds wrote:
> 
> On 18 Jun 2009, at 13:55, Jon Dye wrote:
>> I'm currently tailing some log files so I can watch what's going on
>> with a particular process.  What I'd really like to do is to highlight
>> particular matches in the file, preferably with different colours.
>> Does anyone know of any command line applications that could do
>> something like this?
> 
> If set up correctly grep will colour matches - the only problem being  
> it will only do one at a time.
> 
> -- 
> David Reynolds
> david at reynoldsfamily.org.uk

Try tailing through 'awk', where you can set up whatever set of matches
you want, together with appropriate actions to execute on matching
lines. Then a match can output the matching line through some filter
which would output it coloured (and non-matching lines can be output
"as-is").

If you give us an example of the sort of match you're looking for,
with an example of a non-matching line, I (or others) can show how
to set it up in 'awk'.

Dunno how to program the colouring, though (but I'm sure others know).
Ted.

--------------------------------------------------------------------
E-Mail: (Ted Harding) <Ted.Harding at manchester.ac.uk>
Fax-to-email: +44 (0)870 094 0861
Date: 18-Jun-09                                       Time: 14:54:05
------------------------------ XFMail ------------------------------



More information about the main mailing list