DOKK / manpages / debian 10 / supercat / spc.1.en
SPC(1) User Commands SPC(1)

spc - colorize and print to standard output

spc [OPTION] [-c file|-C directory] [-t type] [FILE]...

Colorize specific patterns in the input and write to standard output. The output may optionally be formatted as a web page.

specify non-standard config file
specify non-standard config file directory
turn on debug information (multi-level -d -d ...)
don't look at ./.spcrc[-ext] for config file
display this help and exit
print only lines that have matches
precede each line with a line number
reverse black and white
dont look in ~/.spcrc for config files
print SYSTEM_DIRECTORY and exit
specify the effective file type or extension
output version information and exit
generate web page

With no FILE read standard input.

Configuration files are required for proper operation. These files are found by searching in a number of locations until a proper one is found. The directories and file names are searched in the following order for a file with the extension ".foo" or if the "-t foo" option is used. Also, if the "-C bar" option is used it's place in the search is shown.


./.spcrc-foo


./.spcrc


~/.spcrc/spcrc-foo


~/.spcrc/spcrc


bar/spcrc-foo


bar/spcrc


SYSTEM_DIRECTORY/spcrc-foo


SYSTEM_DIRECTORY/spcrc

The file extension is obtained by using the characters after the final '.' character in the file name. If there is no extension then the filename itself is used. However, if the extension is "log" then additional processing is done. The filename, i.e. the part of the path after the last '/' character, is used up to the first '.' character. For example, this results in an extension of "apache" for an apache log with the name "apache.0.log". This behavior can be over-ridden using the -t option.

SuperCat configuration files have a fixed columnar format for readability and easy parsing. There are 6 fields per line although only 2-3 require entries. The format is:


1 2 3 4 5 1234567890123456789012345678901234567890123456789012345 HTML Color Name Col A N T RE / String / Characters #################### ### # # # ########################
This optional field specifies the standard HTML color name to
use when creating a web page.  It is only required if the -w
option of Supercat is used.
This is the mandatory three character color name which may take
on one of the values: blk, red, grn, yel, blu, mag, cya or whi.
This is a color attribute which may take on one of the following
values: '-':normal, 'b':bold, 'u':underline,

'r':reverse or 'k':blink. A space ' ' defaults to '-':normal.
This is a single digit number that indicates the number of
matches to color on a single line. '0' indicates all.
A space ' ' defaults to '0':all.
This is a single character which may take on the following
values: 'r':regular expression, 'R':case-insensitive regular
expression, 's':string, 'c':characters or 't':unix time
conversion RE.  A space ' ' defaults to 'r':RE.
An extended regular expression (see regex(7)) specifies the
pattern to match and the pattern or sub-pattern(s) to color.
The portions of the pattern in parentheses are colored.
The string matches the exact string and color it.
For the list of characters, each character is matched
individually and colored.
The time RE extended regular expression specifying a pattern to match
with one sub-pattern to color of the form ([0-9]{10}).  This
should match a 10 decimal digit Unix since 01/01/1970.  This
number will be converted to the human readable form: MMDDHHMMSS
replacing the same 10 columns.

Colorize file spc.c.
Read standard input formatting type C file to standard output.

Take a look at some of the configuration files delivered with SuperCat that can be found in the SYSTEM_DIRECTORY. The following are a few simple examples of the syntax of the configuration file.

Color a time field HH:MM:SS but not the colons.
Match a 10 decimal digit number at the beginning of a line treating it as a Unix seconds since epoch and convert it to MMDDHHMMSS in cyan.
Similar to above but using numeric count.
Color quoted string in yellow.

Written by Mark P Anderson and Thomas G Anderson. Tested by David B Anderson. Maintained by Thomas G Anderson.

Report bugs to <bug-spc@nosredna.net>.

Copyright © 2007-2015 Thomas G Anderson
This is free software. You may redistribute copies of it under the terms of the GNU General Public License <http://www.gnu.org/licenses/gpl.html>. There is NO WARRANTY, to the extent permitted by law.

January 2017 spc 0.5.6