Colouring MCM Output with GRC
I enjoy seeing a variety of colours in my terminals. I am currently using GRC to colour mcm's output because it's fast enough and capable. I also use it to colour the output from quite a few other programs.
MCM's manpage contains some examples of using grc, including some suggested bash aliases (in the notes section and in the examples section).
Here is a (rather long) extract that you too might find useful:
MCM Grc import Admin.Packages as Packages import MCM.Require as Require define confentry(fg name regexp bg = count = once pos = 050 special = ) Require.require location> Grc.confentry regex> (on_[a-z]+)? str> @bg Require.require location> Grc.confentry regex> [0-9]{3} str> @pos Fragment group> @name name> @pos@regexp content: regexp=@regexp + colours=@fg @bg @special + count=@count define conffile(commentlines name) File mode> 644 path> /usr/share/grc/conf.@name content: @commentlines + +$fragments(@name,,,@NEWLINE====@NEWLINE) define frontend(conffile regex) File content>$fragments(frontend,,,@NEWLINE@NEWLINE) mode> 644 path> /etc/grc.conf Fragment content> @regex@NEWLINE@conffile group> frontend define grc() Packages.add package> grc .frontend conffile> conf.configure regex> (^|[/\w\.]+/)configure .frontend conffile> conf.gcc regex> (^|[/\w\.]+/)g?cc\s .frontend conffile> conf.gcc regex> (^|[/\w\.]+/)g?make\s? .frontend conffile> conf.irclog regex: # anything to do with irc@NEWLINE\b\w+\b.*irc.* .frontend conffile> conf.ldap regex> (^|[/\w\.]+/)ldap .frontend conffile> conf.log regex> \b\w+\b.*log\b .frontend conffile> conf.ping regex> (^|[/\w\.]+/)ping6?\s .frontend conffile> conf.traceroute regex> (^|[/\w\.]+/)traceroute6?\s .stdFrontend name> cvs .stdFrontend name> diff .stdFrontend name> dig .stdFrontend name> ifconfig .stdFrontend name> last .stdFrontend name> ls .stdFrontend name> mount .stdFrontend name> mtr .stdFrontend name> netstat .stdFrontend name> ps .stdFrontend name> wdiff .grc_dict .grc_fsck_log .grc_mcm .grc_ntpq .grc_squid define grc_dict() .stdFrontend name> dict .conffile name> dict commentlines: # Example use: grc dict orange .confentry fg> red name> dict regexp> ^From.*$ .confentry fg> green name> dict regexp: ^ [^ ]+ .confentry fg> red name> dict regexp: ^ *Note: .confentry fg> green name> dict regexp> {[^{]+} .confentry fg> cyan name> dict regexp: ^ *\[[^\[]+\]' .confentry fg> cyan name> dict regexp: ^[ ]*(adj|n|v|adv)? *[0-9]+[\.:] .confentry fg> cyan name> dict regexp: ^ *\([a-z]+\) .confentry bg> on_white fg> blue name> dict regexp> (Syn|Ant|syn|ant): .confentry fg> cyan name> dict regexp:$string( (t|i|a|adj|adv|n|v)\. ) .confentry fg> cyan name> dict regexp:$string( (t|i|a|adj|adv|n|v)\.$) define grc_fsck_log() .conffile name> fsck_log commentlines: # Example use: + # cat /var/log/fsck/checkroot | grcat conf.fsck_log + # tail -f -n 200 /var/log/fsck/checkfs | grcat conf.fsck_log .confentry bg> on_white fg> cyan name> fsck_log regexp> ^(Mon|Tue|Wed|Thu|Fri|Sat|Sun).+ .confentry bg> on_white fg> yellow name> fsck_log regexp: ^fsck from util-linux 2\.20\.1$ .confentry bg> on_white fg> yellow name> fsck_log regexp: [0-9]+/[0-9]+ files( \([0-9].[0-9]% non-contiguous\))?, [0-9]+/[0-9]+ blocks .confentry fg> green name> fsck_log regexp: ( clean, ) .confentry fg> blue name> fsck_log regexp: (^/dev/.+: ) .confentry fg> red name> fsck_log regexp: check after next mount|check in [0-9] mount(s)? .confentry fg> red name> fsck_log special> bold regexp: fsck died .confentry fg> green name> fsck_log regexp: ^/dev/\S+ has been mounted [0-9]+ times without being checked, check forced.$ .confentry fg> green name> fsck_log regexp: ^/dev/\S+ has gone 180 days without being checked, check forced.$ define grc_mcm() .stdOrSudoFrontend name> mcm .conffile name> mcm commentlines: # Example use: grc mcm -d .confentry bg> on_yellow fg> red name> mcm special> bold regexp: ^rm -r .confentry fg> green name> mcm regexp> ^install .confentry fg> blue name> mcm regexp> ^rm special> bold .confentry fg> magenta name> mcm regexp: ^ln -s .confentry fg> cyan name> mcm regexp> ^mkdir .confentry bg> on_yellow fg> blue name> mcm regexp> ^<@SPACE special> bold .confentry bg> on_yellow fg> green name> mcm regexp> ^>@SPACE special> bold .confentry bg> on_yellow fg> black name> mcm regexp> ^---$ define grc_ntpq() .stdFrontend name> ntpq .conffile name> ntpq commentlines: # Example use: grc ntpq -p .confentry fg> green name> ntpq regexp: ^[*+]\S+\s+([0-9.]+|\.[GP]PS\.)\s+[123] u\s+[0-9]+\s+[0-9]+\s+377\s+[0-9][0-9]?[0-9]?\.[0-9]+\s+(-)?[0-9][0-9]?\.[0-9]+\s+[0-9][0-9]?\.[0-9]+$ .confentry bg> on_white fg> yellow,black name> ntpq regexp> ^[-]\S+ .confentry bg> on_white fg> red name> ntpq regexp> \b[0-9]+m\b .confentry bg> on_white fg> unchanged,red name> ntpq regexp: ^\S+\s+\S+\s+[0-9] u\s+\S+\s+\S+\s+(?!377)(\S+)\s+ define grc_squid() .conffile name> squid_access_log commentlines: # Config file for viewing squid access logs + # Example use: + # tail -f /var/log/squid/access.log|grcat conf.squid_access_log .confentry fg> red name> squid_access_log regexp: ( [0-9]{4,} ) .confentry count> more fg> red name> squid_access_log regexp: ( [0-9]{5,} ) .confentry fg> yellow name> squid_access_log regexp: ( image/[-a-z]+) .confentry fg> blue name> squid_access_log regexp: ( text/[-a-z]+) .confentry fg> cyan name> squid_access_log regexp: ( application/[-a-z]+) .confentry bg> on_white fg> yellow name> squid_access_log regexp: ( GET ) .confentry bg> on_white fg> blue name> squid_access_log regexp: ( POST ) .confentry fg> blue name> squid_access_log regexp: ( TCP_MISS) .confentry bg> on_yellow fg> cyan name> squid_access_log regexp: ( NONE/- ) .confentry bg> on_yellow fg> green name> squid_access_log regexp: ( DIRECT/) .confentry bg> on_yellow fg> blue name> squid_access_log regexp: ( FIRST_UP_PARENT/) define stdFrontend(name) .frontend conffile> conf.@name regex> (^|[/\w\.]+/)@name\s? define stdOrSudoFrontend(name) .frontend conffile> conf.@name regex: (^|[/\w\.]+/|sudo )@name\s?