SPC(1)
π SPC(1) β like, the manual page, but make it make sense π
okay bestie, gather round, because this is spc(1) from the User Commands corner of the manual, and honestly? it's giving colorize-and-print-to-stdout main character energy. let's go π¦
β¨ NAME β¨
spc β colorize stuff and print it to standard output. that's the whole vibe, no cap. π
πΈ SYNOPSIS πΈ
spc [OPTION] [FILE]...
[-c file|-C directory]
[-t type]
[-e color|(RE)]
[-E color,attribute,count,type|(RE)]
π DESCRIPTION π
so basically: it colorizes specific patterns in the input and writes them to standard output. and if you want, the output can also be formatted as a whole web page. iconic behavior honestly.
-c|--config=FILEβ point it at a non-standard config file π-C|--config-dir=DIRβ point it at a non-standard config file directory π-d|--debugβ turn on debug info. and yes you can stack it: multi-level-d -d ...π-e|--cmd-sβ short-form command-line color instruction β¨-E|--cmd-lβ long-form command-line color instruction π«-h|--helpβ display this help and dip out π-m|--matchingβ print only the lines that have matches π―-n|--line-numbersβ slap a line number in front of every line π’-r|--reverseβ reverse black and white π€π€-R|--nohomedirβ don't go looking in~/.spcrcfor config files π«π-S|--printsysdirβ printSYSTEM_DIRECTORYand exit π¨οΈ-t|--type=TYPEβ specify the effective file type or extension π·οΈ-v|--versionβ output version info and exit π-w|--webpageβ generate a web page π
and if you give it no FILE at all, it just reads standard input. easy. π«Ά
π CONFIGURATION FILE SEARCH π
okay so this part matters: config files are required for proper operation. like, required required. fr fr. π₯
it finds them by searching a bunch of locations until it hits a proper one. the directories and file names get searched in this exact order, looking for a file with the extension .foo β or, if you used the -t foo option, that extension instead. and if you used -C bar, then its place in the search is shown right there in the list too:
./.spcrc-foo
./.spcrc
~/.spcrc/spcrc-foo
~/.spcrc/spcrc
bar/spcrc-foo
bar/spcrc
SYSTEM_DIRECTORY/spcrc-foo
SYSTEM_DIRECTORY/spcrc
so how does it get that extension? it takes the characters after the final . in the file name. if there's no extension at all, it just uses the filename itself. π§
BUT β and this is the plot twist β if the extension is log, then extra processing happens. the filename, meaning the part of the path after the last /, gets used up to the first .. so for example, an apache log named apache.0.log ends up with an extension of apache. wild, right? π
and if you want to override all of that, the -t option is right there. π
π CONFIGURATION FILE FORMAT π
SuperCat config files have a fixed columnar format β for readability and easy parsing. there are 6 fields per line, although only 2-3 of them actually require entries. the format is:
1 2 3 4 5
1234567890123456789012345678901234567890123456789012345
HTML Color Name Col A N T RE / String / Characters
#################### ### # # # ########################
now let's break down every single field, because we do not skip. π
π¨ HTML Color Name (columns 1-20)
optional field. it says which standard HTML color name to use when creating a web page. it's only required if you're using Supercat's -w option.
ποΈ Col - Color (columns 22-24)
this one is mandatory. it's the three character color name, and it can be one of:
blk, red, grn, yel, blu, mag, cya, whi
β¨ A - Color Attribute (column 26)
a color attribute, and it takes one of these values:
'-':normal, 'b':bold, 'u':underline
π’ N - Number of matches to color (column 28)
a single digit number that tells it how many matches to color on a single line. '0' means all of them. a space ' ' defaults to '0':all.
π― T - Type of Match (column 30)
a single character, and here's the full menu:
r: regular expressionR: regular expression (case-insensitive)s: stringc: characterst: unix time conversion RE (MMDDHHMMSS)T: unix time conversion RE (YYMMDDHHMM)u: unix time conversion RE ( HH:MM:SS)U: unix time conversion RE (YYYY:MM:DD)
a space ' ' defaults to 'r':RE.
okay and now the details, because these all behave differently:
- 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 the ones that get colored. π - the string matches the exact string and colors it.
- for the list of characters, each character is matched individually and colored.
- the time RE extended regular expression specifies a pattern to match with one sub-pattern to color of the form
([0-9]{10}). this should match a 10 decimal digit Unix seconds since01/01/1970. that number gets converted to the human readable form:MMDDHHMMSSorYYMMDDHHMM, replacing the same 10 columns. β°
π§΅ RE / String / Characters - Attribute (columns 32-)
(yep, that's the field. go off.)
π» COMMAND LINE EXAMPLES π»
spc spc.ccolorize the filespc.c.cat spc.c | spc -t cread standard input, formatting it as a type C file, and write it to standard output.
π CONFIGURATION FILE EXAMPLES π
go take a peek at some of the config files delivered with SuperCat β you'll find them in the SYSTEM_DIRECTORY. but here are a few simple examples of the config file syntax so you can see the vibe:
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, treat it as Unix seconds since epoch, and convert it to MMDDHHMMSS in cyan. π
Cyan cya 1 t ([0-9]{10})
similar to the one above, but using numeric count.
Yellow yel "(.*)"
color a quoted string in yellow. π
π AUTHORS π
written by Mark P Anderson and Thomas G Anderson. tested by David B Anderson. maintained by Thomas G Anderson.
π€ REPORTING BUGS π€
report bugs to <bug-spc@nosredna.net>. please and thank you, bestie. π
π COPYRIGHT π
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.
like, genuinely no warranty. don't come for us. π
okay that's the whole page!! this was spc version 0.5.8, dated January 2022, and honestly? she ate. periodt. π
β¨ππ¦π
π¦ where this page comes from
- ubuntu resolute: supercat 0.5.8-1 Β· GPL-3.0-or-later
- ubuntu stonking: supercat 0.5.8-1 Β· GPL-3.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms