I have asked many questions of this group and gotten many good answers. 
No matter how dumb the question, I have always gotten a kind response.

Thank you.

The fruit of my recent efforts is a program that colorizes text for
easier viewing.  I needed something that would highlight errors in log
files as they scrolled by.  I couldn't find what I wanted so I wrote
one.

Here it is for all to use.  I hope someone besides myself can find it
useful. send it along to whomever you like.

I'm sure there are many improvements that the guru's who subscribe to
this list can make, but it's my first effort and it works.  Hallelujah!

Anyway, thanks for your help.

-Michael

Attachment: filter.pl
Description: Binary data

Attachment: maillog.colors
Description: Binary data

Usage:  {Some command that sends text to STDIN} | filter.pl {config-file}

The config file takes a simple text file with exactly two parameters per line
separated by a comma.

The first parameter is the word or phrase to search for in the text stream.
The second parameter is the name of the color you want that word or phrase
to be changed to.  The list of color names recognized is:

red
brown
blue
green
cyan
purple
gray
ltred
yellow
ltblue
ltgreen
ltcyan
ltpurple
white
ltgray

Examples:

tail -f /var/log/maillog | filter.pl maillog.colors

maillog.colors contains:
reject,red
postfix,yellow
status=,ltred
connection from,purple

In the stream of text flowing through into the maillog file, the word "reject"
will be displayed in red, "postfix" in yellow, "status=" in light red,
and the phrase "connection from" will be in purple.  There is no limit on the 
number of words or phrases you can search for.

Legal mumbo-jumbo:

What you see is what you got.  There is no warranty included or implied.  If
it blows up your machine, discovers Elvis living in San Antonio, or causes
the WOPR to start world war 3, don't come to me about it.  You've got the
source code, you know what it does!

Copyright 2003 by Michael Weber
Released into the public domain 2003


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to