Rechercher une page de manuel
spc
Langue: en
Version: March 2007 (debian - 07/07/09)
Section: 1 (Commandes utilisateur)
Sommaire
NAME
spc - colorize and print to standard outputSYNOPSIS
spc [OPTION] [-c file|-C directory] [-t type] [FILE]...DESCRIPTION
Colorize specific patterns in the input and write to standard output. The output may optionally be formatted as a web page.
- -c | --config=FILE
- specify non-standard config file
- -C | --config-dir=DIR
- specify non-standard config file directory
- -d | --debug
- turn on debug information (multi-level -d -d ...)
- -D | --no-extension
- don't look at ./.spcrc[-ext] for config file
- -h | --help
- display this help and exit
- -m | --matching
- print only lines that have matches
- -n | --line-numbers
- precede each line with a line number
- -r | --reverse
- reverse black and white
- -R | --nohomedir
- dont look in ~/.spcrc for config files
- -S | --printsysdir
- print SYSTEM_DIRECTORY and exit
- -t | --type=TYPE
- specify the effective file type or extension
- -v | --version
- output version information and exit
- -w | --webpage
- generate web page
With no FILE read standard input.
CONFIGURATION FILE SEARCH
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.
CONFIGURATION FILE FORMAT
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 #################### ### # # # ########################
- HTML Color Name (columns 1-20)
- 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.
- Col - Color (columns 22-24)
- 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.
- A - Color Attribute (column 26)
- 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.
- N - Number of matches to color (column 28)
- 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.
- T - Type of Match(column 30)
- This is a single character which may take on the following values: 'r':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.
- RE / String / Characters - Attribute (columns 32-)
COMMAND LINE EXAMPLES
- spc spc.c
- Colorize file spc.c.
- cat spc.c | spc -t c
- Read standard input formatting type C file to standard output.
CONFIGURATION FILE EXAMPLES
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.- Magenta mag - 0 r ([0-9]{2}):([0-9]{2}):([0-9]{2})
- Color a time field HH:MM:SS but not the colons.
- Cyan cya t ^([0-9]{10})
- 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.
- Cyan cya 1 t ([0-9]{10})
- Similar to above but using numeric count.
- Yellow yel "(.*)"
- Color quoted string in yellow.
AUTHORS
Written by Mark Anderson and Thomas Anderson. Tested by David Anderson.REPORTING BUGS
Report bugs to <bug-spc@nosredna.net>. SH COPYRIGHT Copyright © 2007 Thomas G. AndersonThis 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.
Contenus ©2006-2024 Benjamin Poulain
Design ©2006-2024 Maxime Vantorre