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.
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.
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.
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 |