colorcat - finally for the Windows shell
colorcat will help you find the real information in boring, long log ouputs
from development tools or other software. Colorcat works as a standard filter,
which means it takes line from the standard input (redirected or not) and
write to the standard output (which may be redirected also). While reading
input lines, colorcat compares each line to a list of regular expressions
defined a "definition file". If there is a match, colorcat uses the action
defined for that regular expression to either color or erase the line from
the output.
Usage of colorcat
Usage: colorcat.exe <colorfile> [ <options> ]
<colorfile> = filename of a file with color definitions.
Options: /page to wait for a key after one page of text
/num to number the output lines
Format of definition file
A definition file is a normal text file. You may use empty lines to structure file contents to your liking. All lines starting with the semicolon character ";" will be treated as comments and be ignored.
A valid definition is either a hexadecimal color attribute code or the reserved word "delete", followed by an equal sign, followed by a valid regular expression. Please see the file regexp.html file in the archive for a description of the supported syntax for regular expressions.
Here is a very short sample file content:
; -------- start of file --------
; delete all blank lines
delete=^$
; every line that contains "colorcat" will be bright red
0C=colorcat
; every line with a three-digit number with one leading zero
; is bright cyan on blue background
1B=0[0-9][0-9]
; -------- end of file --------
Sample files
The archive contains a file named colors.dat that you may use
for you first steps in cmodifying the definitions. Try piping
the output of the "dir" command to colorcat, like so:
dir | colorcat colors.dat
If you want to see a sample output, have a look at the image
file sample.jpg that shows how the filtered output looks like.
Why did I choose those strange color codes?
Well, the real reason is that they are still used inside the
Windows console API and may developers (including me) know
them by heart from old DOS times (did I tell you I'm a PC
dinosaur? <g>). Here is a list for all of you. The first
digit of the color code defines the background color, the
second digit defines the foreground color. If you loose
this list, just ask Google to dig up any old DOS color
attribute code list ...
0 = black
1 = dark blue
2 = green
3 = cyan
4 = red
5 = magenta
6 = brown
7 = light gray
8 = dark gray
9 = blue
A = bright green
B = bright cyan
C = bright red
D = bright magenta
E = yellow
F = white
Download
You can download the file here. Its about 150 KBytes. Just copy the exe to some place you like and that's aboutit with the installation. If you need help with regular expressions, check out the html file describing the syntax supported. The sample definition file should get you started building your own color filters. Have fun!