Colorize.pl - The stdin to stdout colorizer

›› Unix und Perl ›› Unix Applications

Info:

Written by Daniel Flinkmann
Current Version: 0.4a
Last Update: 11.01.2008

New in 0.4a:

* for partial colorization the searchstring can be a regular expression.

About:

Use any kind of stdin text stream and it will send it on stdout colorized.

e.g.: ls -lF | colorize.pl [options]

colorize.pl will print out every line from stdin to stdout. However rows with matching strings, will be colorized with your choice of color.

Options:

Colorize whole rows:
Standard Options format: -[style][foreground][background]:[searchstring]
Quick colorize Option format: -[searchstring]

Colorize single matching words:
Standard Options format: +[style][foreground][background]:[searchstring]
Quick colorize Option format: +[searchstring]

[style]
n = normal, l = light, u=underscore, i = inverted, b = blinking

[foreground color]
0= black, 1= red, 2= green, 3= yellow, 4= blue, 5= purple, 6= cyan, 7= white

[background color]
0= black, 1= red, 2= green, 3= yellow, 4= blue, 5= purple, 6= cyan, 7= white, 8= no background

[searchstring]
string

Examples:

Standard Option Example:
cat debug.txt | colorize.pl -u17:error -n37:warning -b10:funny
will colorize whole rows with the word:
* "error" underscored in red front color and white background
* "warning" in green front color and white background
* "funny" blinking in red front color with black background

Quick colorise Option Example:
cat output-logfile.txt | colorize.pl -:error -:warning -:funny
* "error" colored with first preset color
* "warning" colored with second preset color
* "funny" colored with third preset color

Colorise just the matched word:
cat output-logfile.txt | colorize.pl +:warning
will colorise just the word "warning" with the first preset color set.

cat output-logfile.txt | colorize.pl +u18:error
will colorize just the word "error" red with no background and underscore it.

cat output-logfile.txt | colorize.pl +:'\s'
will colorize all kind of spaces and tabs

cat output-logfile.txt | colorize.pl +:'\t' +:' '
will colorize all kind all tabs in one color and spaces in a different color
(Great feature for config files which are tab versus space sentive, like sendmail configurations)


Download:

Colorize.pl - Version 0.4a (click on the icon to download)
Download colorize-0.4a.tgz - 3 kB