├── CHANGES ├── COPYING ├── CREDITS ├── INSTALL ├── README.markdown ├── Regexp.txt ├── TODO ├── _grc ├── colourfiles ├── conf.ant ├── conf.blkid ├── conf.common ├── conf.configure ├── conf.curl ├── conf.cvs ├── conf.df ├── conf.diff ├── conf.dig ├── conf.dnf ├── conf.docker-machinels ├── conf.dockerimages ├── conf.dockerinfo ├── conf.dockernetwork ├── conf.dockerps ├── conf.dockerpull ├── conf.dockersearch ├── conf.dockerversion ├── conf.du ├── conf.dummy ├── conf.env ├── conf.esperanto ├── conf.fdisk ├── conf.findmnt ├── conf.free ├── conf.gcc ├── conf.getfacl ├── conf.getsebool ├── conf.go-test ├── conf.id ├── conf.ifconfig ├── conf.iostat_sar ├── conf.ip ├── conf.ipaddr ├── conf.ipneighbor ├── conf.iproute ├── conf.iptables ├── conf.irclog ├── conf.iwconfig ├── conf.jobs ├── conf.kubectl ├── conf.last ├── conf.ldap ├── conf.log ├── conf.lolcat ├── conf.ls ├── conf.lsattr ├── conf.lsblk ├── conf.lsmod ├── conf.lsof ├── conf.lspci ├── conf.mount ├── conf.mtr ├── conf.mvn ├── conf.netstat ├── conf.nmap ├── conf.ntpdate ├── conf.php ├── conf.ping ├── conf.ping2 ├── conf.proftpd ├── conf.ps ├── conf.pv ├── conf.semanageboolean ├── conf.semanagefcontext ├── conf.semanageuser ├── conf.sensors ├── conf.showmount ├── conf.sockstat ├── conf.sql ├── conf.ss ├── conf.stat ├── conf.sysctl ├── conf.systemctl ├── conf.tcpdump ├── conf.traceroute ├── conf.tune2fs ├── conf.ulimit ├── conf.uptime ├── conf.vmstat ├── conf.wdiff ├── conf.whois └── conf.yaml ├── contrib ├── conf.efingerd ├── mrsmith │ ├── README.md │ ├── conf.dig │ ├── conf.ifconfig │ ├── conf.mtr │ ├── conf.netstat │ └── conf.ps ├── nmh-in-color │ ├── README │ ├── configs │ │ ├── bashrc-entries │ │ ├── conf.flists │ │ ├── conf.inc │ │ ├── conf.mail │ │ ├── conf.scan │ │ ├── grc.conf-entries │ │ ├── mh_profile-entries │ │ ├── mhl.body │ │ ├── mhl.format │ │ ├── mhl.headers │ │ └── rxvt-resources │ └── scripts │ │ ├── viewmail │ │ └── vimail └── wrap-ccache ├── debian ├── changelog ├── compat ├── control ├── copyright ├── dirs ├── docs ├── grc.default ├── rules └── source │ └── format ├── grc ├── grc.1 ├── grc.conf ├── grc.fish ├── grc.sh ├── grc.spec ├── grc.spec.old ├── grc.zsh ├── grcat ├── grcat.1 └── install.sh /CHANGES: -------------------------------------------------------------------------------- 1 | debian/changelog -------------------------------------------------------------------------------- /COPYING: -------------------------------------------------------------------------------- 1 | debian/copyright -------------------------------------------------------------------------------- /CREDITS: -------------------------------------------------------------------------------- 1 | Credits where credits are due: 2 | These people helped me with ideas, support and other things: 3 | 4 | Piotr Klaban 5 | Jason Tackaberry 6 | Eivind Tagseth 7 | Edward Betts 8 | Joey Hess 9 | Miguel Gualdron 10 | Daniel Kollár 11 | Christian Zuckschwerdt 12 | Paul Oppenheim 13 | Emanuele Aina 14 | April Arcus 15 | Justin J. Novack 16 | Ben Hoskins 17 | Nikolay Kolev 18 | Juraj Bednar 19 | Francisco De Lozanne 20 | Duncan Overbruck 21 | delphinus 22 | Aditya Bhargava 23 | Cemil Browne 24 | Ruben Barkow 25 | Efreak 26 | Alexander Kuntashov 27 | Isaias Piña 28 | Andrew Wong 29 | Max 30 | Pavel Vishnyakov 31 | tomaszn 32 | Nicolas Leclercq 33 | Dave Wikoff 34 | richi235 35 | Ricardo J. Barberis 36 | Joe Block 37 | iamoverit 38 | Oxicode 39 | Jonas Minnberg 40 | alcik 41 | Henry Eklind 42 | Justin Lecher 43 | 44 | 45 | -------------------------------------------------------------------------------- /INSTALL: -------------------------------------------------------------------------------- 1 | =================================================================== 2 | Generic Colouriser 3 | 4 | Radovan Garabík 5 | http://kassiopeia.juls.savba.sk/~garabik/software/grc.html 6 | 7 | =================================================================== 8 | Requirements: 9 | Anything with a python interpreter, with more or less work needed 10 | if it is not unix. 11 | 12 | If you have a debian system with all necessary packages installed, type 13 | dpkg-buildpackage (or dpkg-buildpackage -rfakeroot) in the package's 14 | directory, then type 15 | dpkg -i ../grc*deb 16 | 17 | else: 18 | 19 | 1) copy colourfiles/conf.* files into /usr/share/grc/ or /usr/local/share/grc/, 20 | creating directories when needed 21 | 22 | 2) copy grc.conf into /etc/ 23 | 24 | 3) copy grc and grcat somewhere to your path 25 | 26 | 4) read the README and manual pages 27 | 28 | 5) modify /etc/grc.conf if you feel like it 29 | 30 | 31 | There is a small shell script called install.sh provided, which 32 | automatically does the above steps. 33 | 34 | If you're on OS X and using Homebrew, 35 | brew install grc 36 | 37 | -------------------------------------------------------------------------------- /README.markdown: -------------------------------------------------------------------------------- 1 | # Generic Colouriser 2 | 3 | Radovan Garabík (garabik @ kassiopeia.juls.savba.sk) 4 | 5 | For the impatient - try following commands: 6 | 7 | grc netstat 8 | grc ping hostname 9 | grc tail /var/log/syslog 10 | grc ps aux 11 | 12 | Being overflooded with different logfile colo(u)?ri(s|z)ers, colortails, gccolors, colormakes and similar programs for making text files or outputs of different programs more readable by inserting ansi colour control codes into them, I decided to write my very own colouriser, eventually providing the functions of all those others. 13 | 14 | Two programs are provided: `grc` and `grcat`. The main is `grcat`, which acts as a filter, i.e. taking standard input, colourising it and writing to standard output. 15 | 16 | ## Configuration 17 | 18 | `grcat` takes as a parameter the name of configuration file. 19 | 20 | Directories `~/.grc/`, `/usr/local/share/grc/`, `/usr/share/grc/` are searched for the file (in this order). If the file is not found, it is assumed to be an absolute path of a configuration file located elsewhere. 21 | 22 | Configuration file consists of entries, one per regexp, entries are separated with lines with first character non-alphanumeric (except #). Lines beginning with # or empty lines are ignored. 23 | 24 | Each entry consists of several lines. 25 | 26 | Each line has form: `keyword=value` 27 | 28 | where keyword is one of: regexp, colours, command, concat, skip, replace, count 29 | 30 | Only regexp is mandatory, but it does not have much sense by itself unless you specify at least a colour, skip, replace or command keyword as well. 31 | 32 | **regexp** is the regular expression to match. 33 | 34 | **colours** is the list of colours, separated by commas (you can specify only one colour), each colour per one regexp group specified in regexp. 35 | 36 | if you use special colour name "previous", colour of the previous line of text will be used (actually, if both the first and last character of the previous line are of different colour than the default one, colour of the first one will be used). 37 | 38 | Another special colour name "unchanged" will leave the colour unchanged, useful if you need some context for matching regular expression and you want to leave the colour of context unchanged. 39 | 40 | Yet another special name is an arbitrary string enclosed in straight quotes. This string will be inserted directly into the output in front of the matching expression. The string will be eval'ed, so you can use usual python escape sequences. 41 | 42 | This is useful on a 256-colour enabled xterm, where e.g. `colours="\033[38;5;22m"` will give you a dark green (inspired by Rutger Ovidius). Caveat: the string cannot contain a comma. This is due to my laziness :-) 43 | 44 | **command** is command to be executed when regexp matches. Its output will be mixed with normal stdout, use redirectors (`>/dev/null`) if you want to suppress it. 45 | 46 | **concat** is the name of a file which the current line will be appended to when the regexp matches. 47 | 48 | **skip** can be `skip=yes`, if that case the matched line is skipped (discarded from the output), or `skip=no`, when it is not skipped. Default (if you do not have skip keyword) is of course not skipped. 49 | 50 | **replace** means the regular expression match will be replaced by the value. All the preceeding regular expressions will be evaluated against the original text, but if they match and the replacement changes the length of the text, the colouring will *stay at the same positions*, which is probably not what you want - therefore put the `replace` rule preferrably at the beginning of config file. 51 | 52 | all the following regular expressions will be evaluated against the replaced text, not the original. 53 | 54 | replacement is done by `re.sub()`, therefore you can use anything python supports - in particular, `\1`, `\2` etc... to include text from the original matching groups, e.g: 55 | 56 | regexp=(\d\d):(\d\d):(\d\d) 57 | replace=\1h\2m\3s 58 | 59 | will change time format from 09:43:59 into 09h43m59s 60 | 61 | **count** is one of words: once, more, stop, previous, block or unblock 62 | 63 | - **once** means that if the regexp is matched, its first occurrence is coloured and the program will continue with other regexp's. 64 | - **more** means that if there are multiple matches of the regexp in one line, all of them will be coloured. 65 | - **stop** means that the regexp will be coloured and program will move to the next line (i.e. ignoring other regexp's) 66 | - **previous** means the count will be the same as for the previous line 67 | - **block** marks a start of a multiline block of text, coloured with the same colour 68 | - **unblock**, obviously, marks the end of such a block 69 | 70 | example: 71 | 72 | # this is probably a pathname 73 | regexp=/[\w/\.]+ 74 | colour=green 75 | count=more 76 | 77 | this will match `/usr/bin`, `/usr/local/bin/`, `/etc/init.d/syslogd` and similar strings and paint it with green. 78 | 79 | Another example: 80 | 81 | regexp=^-{1,2}\s{0,1}$ 82 | colours=red 83 | count=block 84 | - 85 | regexp=^\s{0,5}$ 86 | colours=default 87 | count=unblock 88 | 89 | this will turn all correctly formatted mail signatures red. 90 | 91 | Regular expressions are evaluated from top to bottom, this allows nested and overlapped expressions. (e.g. you colour everything inside parentheses with one colour, and if a following expression matches the text inside parentheses, it will be also coloured). 92 | 93 | # Typical usage: 94 | 95 | grcat conf.log < /var/log/syslog 96 | /usr/sbin/traceroute www.linux.org | grcat conf.traceroute 97 | grcat conf.esperanto < Fundamento.txt | less -r 98 | 99 | To facilitate the use, command `grc` acts as frontend for `grcat`, automatically choosing the configuration files, so you can write: 100 | 101 | grc netstat 102 | grc ping hostname 103 | grc tail /var/log/syslog 104 | 105 | etc... 106 | 107 | `grc` will execute command command with optional parameters piping its stdout into `grcat`. 108 | 109 | Configuration file for `grcat` is determined by `/etc/grc.conf` or `~/.grc/grc.conf` file. 110 | 111 | Format of `/etc/grc.conf` or `~/.grc/grc.conf:` each entry consists of 2 lines, between entries there can be any number of empty lines or lines beginning with # (comments). 112 | 113 | First line is regular expression, second line the name of configuration file for `grcat`. 114 | 115 | Configuration file after the first regular expression matching the rest of line after `grc` will be passed to grcat as its configuration file 116 | 117 | For example, if you have 118 | 119 | # log file 120 | \b\w+\b.*log\b 121 | conf.log 122 | 123 | # traceroute command 124 | (^|[/\w\.]+/)traceroute\s 125 | conf.traceroute 126 | 127 | in your `/etc/grc.conf`, then typing `grc cat /var/log/syslog` will use `conf.log` to colourise the output, `grc /usr/sbin/traceroute www.linux.org` will use `conf.traceroute`. 128 | 129 | ## Miscellaneous remarks: 130 | 131 | You should get yourself familiar with regular expressions. Good reading is 132 | at 133 | 134 | The program is not yet optimized for speed. There are places that can 135 | give a big boost if optimized. 136 | 137 | Regular expressions are handled by python, it means that they may be 138 | slightly different from those you know from perl or grep. It's not my 139 | fault in that case. 140 | 141 | Colours are one of: 142 | 143 | none, default, bold, underline, blink, reverse, concealed, 144 | black, green, yellow, blue, magenta, cyan, white, 145 | on_black, on_green, on_yellow, on_blue, on_magenta, on_cyan, on_white 146 | beep 147 | 148 | `on_red` means that the background (instead of foreground) is painted 149 | with red etc... 150 | 151 | Additional colours can be: `dark, italic, rapidblink, strikethrough`. 152 | These are supported only on some terminals, so if you want to write 153 | portable configuration files, avoid uing them (idea by James Rowe). 154 | 155 | there can be more attributes per line (separated by space), e.g. 156 | 157 | # this is probably a pathname 158 | regexp=/[\w/\.]+ 159 | colours=bold blink green 160 | count=more 161 | 162 | will display pathnames in bold blinking green 163 | 164 | ## Python 2 & 3 compatibility 165 | 166 | both grc and grcat are targetted towards python3 now; there is an attempt at python2 compatibility, meaning that both grc and grcat will run under both python2 and python3. However, all the regular expressions are strings, and grcat works on string input (not bytes). 167 | 168 | ## Hints 169 | 170 | Following commands will display nice coloured log in virtual console 12: 171 | 172 | If you have GNU tail: 173 | 174 | tail --follow=name /var/log/syslog | grcat conf.log >/dev/tty12 175 | 176 | or, if you have recent BSD tail: 177 | 178 | tail -F /var/log/syslog | grcat conf.log >/dev/tty12 179 | 180 | ## Automatic aliases 181 | 182 | You can start using grc automatically with supported commands. The following assumes that `grc.` is in `/etc`. The location may differ (i. e. `/usr/local/etc` when installed with [homebrew](https://formulae.brew.sh/formula/grc)); or the `grc.sh` can be placed into `/etc/profile.d/` (this is in fact the default). Be aware this is somewhat invasive and better test it before deploying. 183 | 184 | ### Bash 185 | 186 | To set aliases for supported commands, append to your `~/.bashrc`: 187 | 188 | GRC_ALIASES=true 189 | [[ -s "/etc/profile.d/grc.sh" ]] && source /etc/grc.sh 190 | 191 | If the file `/etc/default/grc` exists, it is sourced first, therefore you can place a line saying `GRC_ALIASES=true` there. 192 | 193 | ### ZSH 194 | 195 | Or for zsh users, append to `~/.zshrc`: 196 | 197 | [[ -s "/etc/grc.zsh" ]] && source /etc/grc.zsh 198 | 199 | ### Fish 200 | 201 | Add to `~/.config/fish/config.fish` or in a new file in `~/.config/fish/conf.d/`: 202 | 203 | source /usr/local/etc/grc.fish 204 | 205 | ## Dynamic aliases 206 | 207 | By running the follow code, it will check to see what programs are already installed on your OS (based on your `$PATH`), and echo out the result. This could then be added to your shell resource file as a one off. Alternatively, by removing the `echo` in the code, it could be placed into your shell resource file directly, and it will create the necessarily aliases each time: 208 | 209 | for cmd in g++ gas head make ld ping6 tail traceroute6 $( ls /usr/share/grc/ ); do 210 | cmd="${cmd##*conf.}" 211 | type "${cmd}" >/dev/null 2>&1 && echo alias "${cmd}"="$( which grc ) --colour=auto ${cmd}" 212 | done 213 | -------------------------------------------------------------------------------- /Regexp.txt: -------------------------------------------------------------------------------- 1 | 2 | Regular Expression Syntax (taken from python library reference) 3 | 4 | A regular expression (or RE) specifies a set of strings that matches 5 | it; the functions in this module let you check if a particular string 6 | matches a given regular expression (or if a given regular expression 7 | matches a particular string, which comes down to the same thing). 8 | 9 | Regular expressions can be concatenated to form new regular 10 | expressions; if A and B are both regular expressions, then AB is also 11 | an regular expression. If a string p matches A and another string q 12 | matches B, the string pq will match AB. Thus, complex expressions can 13 | easily be constructed from simpler primitive expressions like the 14 | ones described here. For details of the theory and implementation of 15 | regular expressions, consult the Friedl book referenced below, or 16 | almost any textbook about compiler construction. 17 | 18 | A brief explanation of the format of regular expressions follows. For 19 | further information and a gentler presentation, consult the Regular 20 | Expression HOWTO, accessible from http://www.python.org/doc/howto/. 21 | 22 | Regular expressions can contain both special and ordinary characters. 23 | Most ordinary characters, like "A", "a", or "0", are the simplest 24 | regular expressions; they simply match themselves. You can 25 | concatenate ordinary characters, so last matches the string 'last'. 26 | (In the rest of this section, we'll write RE's in this special style, 27 | usually without quotes, and strings to be matched 'in single 28 | quotes'.) 29 | 30 | Some characters, like "|" or "(", are special. Special characters 31 | either stand for classes of ordinary characters, or affect how the 32 | regular expressions around them are interpreted. 33 | 34 | The special characters are: 35 | 36 | "." 37 | (Dot.) In the default mode, this matches any character except a newline. If the 38 | DOTALL flag has been specified, this matches any character including a newline. 39 | "^" 40 | (Caret.) Matches the start of the string, and in MULTILINE mode also matches 41 | immediately after each newline. 42 | "$" 43 | Matches the end of the string, and in MULTILINE mode also matches before a newline. 44 | foo matches both 'foo' and 'foobar', while the regular expression foo$ matches only 45 | 'foo'. 46 | "*" 47 | Causes the resulting RE to match 0 or more repetitions of the preceding RE, as many 48 | repetitions as are possible. ab* will match 'a', 'ab', or 'a' followed by any 49 | number of 'b's. 50 | "+" 51 | Causes the resulting RE to match 1 or more repetitions of the preceding RE. ab+ 52 | will match 'a' followed by any non-zero number of 'b's; it will not match just 'a'. 53 | "?" 54 | Causes the resulting RE to match 0 or 1 repetitions of the preceding RE. ab? will 55 | match either 'a' or 'ab'. 56 | *?, +?, ?? 57 | The "*", "+", and "?" qualifiers are all greedy; they match as much text as 58 | possible. Sometimes this behaviour isn't desired; if the RE <.*> is matched against 59 | '

title

', it will match the entire string, and not just '

'. Adding "?" 60 | after the qualifier makes it perform the match in non-greedy or minimal fashion; as 61 | few characters as possible will be matched. Using .*? in the previous expression 62 | will match only '

'. 63 | {m,n} 64 | Causes the resulting RE to match from m to n repetitions of the preceding RE, 65 | attempting to match as many repetitions as possible. For example, a{3,5} will match 66 | from 3 to 5 "a" characters. Omitting n specifies an infinite upper bound; you can't 67 | omit m. 68 | {m,n}? 69 | Causes the resulting RE to match from m to n repetitions of the preceding RE, 70 | attempting to match as few repetitions as possible. This is the non-greedy version 71 | of the previous qualifier. For example, on the 6-character string 'aaaaaa', a{3,5} 72 | will match 5 "a" characters, while a{3,5}? will only match 3 characters. 73 | "\" 74 | Either escapes special characters (permitting you to match characters like "*", 75 | "?", and so forth), or signals a special sequence; special sequences are discussed 76 | below. 77 | If you're not using a raw string to express the pattern, remember that Python also 78 | uses the backslash as an escape sequence in string literals; if the escape sequence 79 | isn't recognized by Python's parser, the backslash and subsequent character are 80 | included in the resulting string. However, if Python would recognize the resulting 81 | sequence, the backslash should be repeated twice. This is complicated and hard to 82 | understand, so it's highly recommended that you use raw strings for all but the 83 | simplest expressions. 84 | [] 85 | Used to indicate a set of characters. Characters can be listed individually, or a 86 | range of characters can be indicated by giving two characters and separating them 87 | by a "-". Special characters are not active inside sets. For example, [akm$] will 88 | match any of the characters "a", "k", "m", or "$"; [a-z] will match any lowercase 89 | letter, and [a-zA-Z0-9] matches any letter or digit. Character classes such as \w 90 | or \S(defined below) are also acceptable inside a range. If you want to include a 91 | "]" or a "-" inside a set, precede it with a backslash, or place it as the first 92 | character. The pattern []] will match ']', for example. 93 | You can match the characters not within a range by complementing the set. This is 94 | indicated by including a "^" as the first character of the set; "^" elsewhere will 95 | simply match the "^" character. For example, [^5] will match any character except 96 | "5". 97 | "|" 98 | A|B, where A and B can be arbitrary REs, creates a regular expression that will 99 | match either A or B. This can be used inside groups (see below) as well. To match a 100 | literal "|", use \|, or enclose it inside a character class, as in [|]. 101 | (...) 102 | Matches whatever regular expression is inside the parentheses, and indicates the 103 | start and end of a group; the contents of a group can be retrieved after a match 104 | has been performed, and can be matched later in the string with the \number special 105 | sequence, described below. To match the literals "(" or "')", use \( or \), or 106 | enclose them inside a character class: [(] [)]. 107 | (?...) 108 | This is an extension notation (a "?" following a "(" is not meaningful otherwise). 109 | The first character after the "?" determines what the meaning and further syntax of 110 | the construct is. Extensions usually do not create a new group; (?P...) is 111 | the only exception to this rule. Following are the currently supported extensions. 112 | (?iLmsx) 113 | (One or more letters from the set "i", "L", "m", "s", "x".) The group matches the 114 | empty string; the letters set the corresponding flags (re.I, re.L, re.M, re.S, 115 | re.X) for the entire regular expression. This is useful if you wish to include the 116 | flags as part of the regular expression, instead of passing a flag argument to the 117 | compile() function. 118 | (?:...) 119 | A non-grouping version of regular parentheses. Matches whatever regular expression 120 | is inside the parentheses, but the substring matched by the group cannot be 121 | retrieved after performing a match or referenced later in the pattern. 122 | (?P...) 123 | Similar to regular parentheses, but the substring matched by the group is 124 | accessible via the symbolic group name name. Group names must be valid Python 125 | identifiers. A symbolic group is also a numbered group, just as if the group were 126 | not named. So the group named 'id' in the example above can also be referenced as 127 | the numbered group 1. 128 | For example, if the pattern is (?P[a-zA-Z_]\w*), the group can be referenced by 129 | its name in arguments to methods of match objects, such as m.group('id')or 130 | m.end('id'), and also by name in pattern text (e.g. (?P=id)) and replacement text 131 | (e.g. \g). 132 | (?P=name) 133 | Matches whatever text was matched by the earlier group named name. 134 | (?#...) 135 | A comment; the contents of the parentheses are simply ignored. 136 | (?=...) 137 | Matches if ... matches next, but doesn't consume any of the string. This is called 138 | a lookahead assertion. For example, Isaac (?=Asimov) will match 'Isaac ' only if 139 | it's followed by 'Asimov'. 140 | (?!...) 141 | Matches if ... doesn't match next. This is a negative lookahead assertion. For 142 | example, Isaac (?!Asimov) will match 'Isaac ' only if it's not followed by 143 | 'Asimov'. 144 | 145 | The special sequences consist of "\" and a character from the list below. If the ordinary 146 | character is not on the list, then the resulting RE will match the second character. For 147 | example, \$ matches the character "$". 148 | 149 | \number 150 | Matches the contents of the group of the same number. Groups are numbered starting 151 | from 1. For example, (.+) \1 matches 'the the' or '55 55', but not 'the end' (note 152 | the space after the group). This special sequence can only be used to match one of 153 | the first 99 groups. If the first digit of number is 0, or number is 3 octal digits 154 | long, it will not be interpreted as a group match, but as the character with octal 155 | value number. Inside the "[" and "]" of a character class, all numeric escapes are 156 | treated as characters. 157 | \A 158 | Matches only at the start of the string. 159 | \b 160 | Matches the empty string, but only at the beginning or end of a word. A word is 161 | defined as a sequence of alphanumeric characters, so the end of a word is indicated 162 | by whitespace or a non-alphanumeric character. Inside a character range, \b 163 | represents the backspace character, for compatibility with Python's string 164 | literals. 165 | \B 166 | Matches the empty string, but only when it is not at the beginning or end of a 167 | word. 168 | \d 169 | Matches any decimal digit; this is equivalent to the set [0-9]. 170 | \D 171 | Matches any non-digit character; this is equivalent to the set [^0-9]. 172 | \s 173 | Matches any whitespace character; this is equivalent to the set [ \t\n\r\f\v]. 174 | \S 175 | Matches any non-whitespace character; this is equivalent to the set [^ \t\n\r\f\v]. 176 | \w 177 | When the LOCALE flag is not specified, matches any alphanumeric character; this is 178 | equivalent to the set [a-zA-Z0-9_]. With LOCALE, it will match the set [0-9_] plus 179 | whatever characters are defined as letters for the current locale. 180 | \W 181 | When the LOCALE flag is not specified, matches any non-alphanumeric character; this 182 | is equivalent to the set [^a-zA-Z0-9_]. With LOCALE, it will match any character 183 | not in the set [0-9_], and not defined as a letter for the current locale. 184 | \Z 185 | Matches only at the end of the string. 186 | \\ 187 | Matches a literal backslash. 188 | -------------------------------------------------------------------------------- /TODO: -------------------------------------------------------------------------------- 1 | optimize for speed 2 | handle ^C intelligently - almost done 3 | (multiline mode) 4 | -------------------------------------------------------------------------------- /_grc: -------------------------------------------------------------------------------- 1 | #compdef grc 2 | 3 | setopt localoptions extended_glob 4 | 5 | local environ e cmd 6 | local -a args 7 | local -a _comp_priv_prefix 8 | 9 | zstyle -a ":completion:${curcontext}:" environ environ 10 | 11 | for e in "${environ[@]}" 12 | do local -x "$e" 13 | done 14 | 15 | args=( 16 | '(-e --stderr)'{-e,--stderr}'[redirect stderr; do not automatically redirect stdout]' 17 | '(-s --stdout)'{-s,--stdout}'[redirect stdout; even with -e/--stderr]' 18 | '(-c --config=)'{-c+,--config=-}'[use as configuration file for grcat]:file:_files' 19 | '--colour=-[colourize output]:colour:(on off auto)' 20 | '(-h --help)'{-h,--help}'[display help message and exit]' 21 | '--pty[run command in pseudotermnial (experimental)]' 22 | '*::arguments:{ _normal }' 23 | ) 24 | 25 | _arguments -s $args 26 | -------------------------------------------------------------------------------- /colourfiles/conf.ant: -------------------------------------------------------------------------------- 1 | # ant grc colorizer configuration 2 | # BUILD FAILED 3 | regexp=BUILD FAILED 4 | colours=bold red 5 | count=more 6 | ============== 7 | # BUILD SUCCESSFUL 8 | regexp=^BUILD SUCCESSFUL 9 | colours=bold green 10 | count=more 11 | ============== 12 | # Total time 13 | regexp=^(Total time: )([\d]+.*)$ 14 | colours=yellow,bold magenta 15 | count=more 16 | =============== 17 | # some error 18 | regexp=[\d]+ error[s]? 19 | colours=red 20 | count=more 21 | ============== 22 | # some warning 23 | regexp=[\d]+ warning[s]? 24 | colours=yellow 25 | count=more 26 | =============== 27 | # some error 28 | regexp=[Ee]rror: 29 | colours=red 30 | count=more 31 | ============== 32 | # some warning 33 | regexp=[Ww]arning: 34 | colours=yellow 35 | count=more 36 | ============== 37 | # project name 38 | regexp=^[^:\s]+:$ 39 | colours=green 40 | count=more 41 | ============== 42 | # products 43 | regexp=[^/]+\.[ewrj]ar$ 44 | colours=blue 45 | count=more 46 | 47 | -------------------------------------------------------------------------------- /colourfiles/conf.blkid: -------------------------------------------------------------------------------- 1 | # Blk 2 | regexp=^(/dev/)(.+):\s 3 | colours=default,green,bright_green 4 | ====== 5 | # Blk mapper 6 | regexp=^/dev/(mapper/)(.+):\s 7 | colours=unchanged,underline green,bright_green 8 | ====== 9 | # UUID 10 | regexp=\sUUID="([^"]+) 11 | colours=bold yellow,blue 12 | ====== 13 | #UUID_SUB 14 | regexp=\sUUID_SUB="([^"]+) 15 | colours=green,bright_green 16 | ====== 17 | # TYPE 18 | regexp=TYPE="([^"]+) 19 | colours=bold cyan,cyan 20 | ====== 21 | # LABEL 22 | regexp=\sLABEL="([^"]+) 23 | colours=bold bright_cyan,bright_cyan 24 | ====== 25 | # PARTLABEL 26 | regexp=\sPARTLABEL="([^"]+) 27 | colours=bold green,red 28 | # PARTUUID 29 | regexp=PARTUUID="([^"]+) 30 | colours=green,magenta 31 | 32 | -------------------------------------------------------------------------------- /colourfiles/conf.common: -------------------------------------------------------------------------------- 1 | # Green Words 2 | regexp=[Ee]nabled?|[Oo]k|[Rr]unning|[Tt]rue 3 | colour=green 4 | - 5 | # Red Words 6 | regexp=[Dd]isabled?|[Ee]rrors?|[Ss]topped|[Ff]alse 7 | colour=red 8 | - 9 | # Yellow Words 10 | regexp=[Ww]arning 11 | colour=yellow 12 | -------------------------------------------------------------------------------- /colourfiles/conf.configure: -------------------------------------------------------------------------------- 1 | # cache functions 2 | regexp=\b(loading|updating|creating) cache\b 3 | colours=yellow bold 4 | ......... 5 | # checking 6 | regexp=\bchecking\s*(for|if|whether|command|how|that)?(\s*to)?\b 7 | colours=bold blue 8 | ......... 9 | # result is complex 10 | regexp=\.\.\. .*$ 11 | colours=bold yellow 12 | ......... 13 | # check succeeded 14 | regexp=\.\.\.( \(cached\))? yes$ 15 | colours=bold cyan 16 | ......... 17 | # check did not succeed 18 | regexp=\.\.\.( \(cached\))? no$ 19 | colours=bold red 20 | ......... 21 | # ... should be normal 22 | regexp=\.\.\. 23 | colours=default 24 | ......... 25 | # creating stuff 26 | regexp=\bcreating\b 27 | colours=green 28 | -------------------------------------------------------------------------------- /colourfiles/conf.curl: -------------------------------------------------------------------------------- 1 | # curl grc colorizer configuration 2 | === 3 | # Outgoing Headers 4 | regexp=^(>) ([\w\-]+): (.*) 5 | colours=default, bright_green, bright_blue, bright_cyan 6 | === 7 | # Incoming Headers 8 | regexp=^(<) ([\w\-]+): (.*) 9 | colours=default, bright_yellow, bright_blue, bright_cyan 10 | === 11 | # Incoming 200 12 | regexp=(HTTP/[\d\.]+) 2\d{2} [\w\s]+ 13 | colours=bright_green on_blue, bright_white on_blue 14 | === 15 | # Incoming 300 16 | regexp=(HTTP/[\d\.]+) 3\d{2}[\w\s]* 17 | colours=bright_green on_blue, bright_white on_blue 18 | === 19 | # Incoming 400 20 | regexp=(HTTP/[\d\.]+) 4\d{2} [\w\s]+ 21 | colours=bright_red on_blue, bright_white on_blue 22 | === 23 | # Incoming 500 24 | regexp=(HTTP/[\d\.]+) 5\d{2} [\w\s]+ 25 | colours=bright_red on_blue, bright_white on_blue 26 | === 27 | # Server certificate 28 | regexp=\* (Server certificate): 29 | colours=magenta, bright_magenta 30 | === 31 | # Certificate Headers 32 | regexp=\* ([a-z][\w\s\d]+): (.*) 33 | colours=magenta, bright_blue, bright_cyan 34 | === 35 | # SSL certificate problem 36 | regexp=SSL certificate problem:( .*) 37 | colours=bright_red, bright_red 38 | === 39 | # SSL certificate verify result: self signed certificate (18), continuing anyway. 40 | regexp=SSL certificate verify result:(.*) 41 | colours=bright_magenta, bright_yellow 42 | === 43 | # SSL certificate verify ok. 44 | regexp=SSL certificate verify (ok) 45 | colours=bright_magenta, bright_green 46 | === 47 | # Verbose Logging 48 | regexp=^([{}\*])\s 49 | colours=default, bright_magenta 50 | count=more 51 | === 52 | # Outgoing 53 | regexp=^>\s 54 | colours=bright_green 55 | count=more 56 | === 57 | # Incoming 58 | regexp=^<\s 59 | colours=bright_yellow 60 | count=more 61 | === 62 | # SSL connection 63 | regexp= (SSL connection) using (.*) / (.*) 64 | colours=magenta, bright_magenta, bright_magenta, bright_magenta 65 | === 66 | # Connected to... 67 | regexp=(Connected) to (.*) \(([\d\.]+)\) port (\d+) 68 | colours=magenta, bright_magenta, bright_magenta, bright_magenta, bright_magenta 69 | === 70 | # Outgoing METHOD 71 | regexp=(GET|HEAD|POST|PUT|DELETE|CONNECT|OPTIONS|TRACE|PATCH) (/.*) HTTP/[\d\.]+ 72 | colours=bright_white on_blue, bright_white on_blue, bright_yellow on_blue 73 | -------------------------------------------------------------------------------- /colourfiles/conf.cvs: -------------------------------------------------------------------------------- 1 | # conflict 2 | regexp=^C .*$ 3 | colours=bold red 4 | count=more 5 | ====== 6 | # modified 7 | regexp=^M .*$ 8 | colours=bold blue 9 | count=more 10 | ====== 11 | # added 12 | regexp=^A .*$ 13 | colours=cyan 14 | count=more 15 | ====== 16 | # removed 17 | regexp=^R .*$ 18 | colours=cyan 19 | count=more 20 | ====== 21 | # unlisted 22 | regexp=^\? .*$ 23 | colours=bold 24 | count=more 25 | -------------------------------------------------------------------------------- /colourfiles/conf.df: -------------------------------------------------------------------------------- 1 | # FS 2 | #regexp=^.*?\s 3 | regexp=^(?!Filesystem)(\/[-\w\d.]+)+\s 4 | colours=blue,bold blue 5 | ====== 6 | # Size 'K' 7 | regexp=\s\d*[.,]?\d(K|B)i?\s|\b\d{1,3}\b 8 | colours=green 9 | ====== 10 | # Size 'M' 11 | regexp=\s\d*[.,]?\dMi?\s|\b\d{4,6}\b 12 | colours=yellow 13 | ====== 14 | # Size 'G' 15 | regexp=\s\d*[.,]?\dGi?\s|\b\d{7,9}\b 16 | colours=red 17 | ====== 18 | # Size 'T' 19 | regexp=\s\d*[.,]?\dTi?\s|\b\d{10,12}\b 20 | colours=bold red 21 | ====== 22 | # Mounted on 23 | regexp=\/$|(\/[-\w\d. ]+)+$ 24 | colours=green,bold green 25 | ====== 26 | # Use 0-60% 27 | regexp=\s[1-6]?[0-9]%\s 28 | colours=green 29 | ====== 30 | # Use 70-89% 31 | regexp=\s[78][0-9]%\s 32 | colours=yellow 33 | ====== 34 | # Use 90-97% 35 | regexp=\s9[0-7]%\s 36 | colours=red 37 | ====== 38 | # Use 98-100% 39 | regexp=\s9[89]%|100%\s 40 | colours=bold red 41 | ====== 42 | # tmpfs lines 43 | regexp=^tmpfs.* 44 | colours=bright_black 45 | -------------------------------------------------------------------------------- /colourfiles/conf.diff: -------------------------------------------------------------------------------- 1 | # new lines and filenames (unified diff) 2 | regexp=^\+(.*$) 3 | colours=bold green 4 | count=more 5 | ======= 6 | # removed lines and filenames (unified diff) 7 | regexp=^\-(--.+$|[^\-].*$|$) 8 | colours=bold red 9 | count=more 10 | ======== 11 | # new lines 12 | regexp=^\>([^\>].*|$) 13 | colours=bold green 14 | count=more 15 | ======= 16 | # removed lines 17 | regexp=^\<([^\<].*|$) 18 | colours=bold red 19 | count=more 20 | ======= 21 | # lines affected 22 | regexp=^@@ .* @@$ 23 | colours=magenta 24 | count=more 25 | -------------------------------------------------------------------------------- /colourfiles/conf.dig: -------------------------------------------------------------------------------- 1 | #domain 2 | regexp=[\S]+\. 3 | colours=bright_magenta 4 | - 5 | #line 6 | regexp=^(\S+).*?(\d+)\t(\w+)\t(\w+)\t 7 | colours=unchanged,magenta,red,yellow,cyan 8 | - 9 | #ip4 address 10 | regexp=\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3} 11 | colours=green 12 | - 13 | #ipv6 14 | regexp=\t(([0-9a-fA-F]{1,4})?\:\:?[0-9a-fA-F]{1,4})+ 15 | colours=dark green 16 | - 17 | #comments 18 | regexp=^;;[\s\w]+ 19 | colours=yellow 20 | - 21 | #Title 22 | regexp=; <<>> DiG.* <<>> (\S+) 23 | colours=default,bold magenta 24 | -------------------------------------------------------------------------------- /colourfiles/conf.dnf: -------------------------------------------------------------------------------- 1 | # Install 2 | regexp=^Installing: 3 | colour=bold green 4 | - 5 | # Main 6 | regexp=^Upgrading: 7 | colour=bold yellow 8 | - 9 | # Main 10 | regexp=^Removing: 11 | colour=bold red 12 | -------------------------------------------------------------------------------- /colourfiles/conf.docker-machinels: -------------------------------------------------------------------------------- 1 | # IMAGE 2 | regexp=^(?!NAME|error)(\S+)\s+(\S+)\s+(\S+) 3 | colours=default,bold yellow,bold black,cyan 4 | ====== 5 | # Running 6 | regexp=\sRunning\s 7 | colours=bold green 8 | ====== 9 | # Stopped 10 | regexp=\sStopped\s 11 | colours=bold red 12 | ====== 13 | # Error 14 | regexp=\sError\s 15 | colours=red 16 | ====== 17 | # PORTS 18 | regexp=((?:\d{1,3}\.){3}\d{1,3}):(\d+) 19 | colours=default,blue,bold blue 20 | ====== 21 | # Error Line 22 | regexp=^error\s(?:\w+\s)+([a-z\-_0-9]+):(.*)$ 23 | colours=red,yellow,bold red 24 | -------------------------------------------------------------------------------- /colourfiles/conf.dockerimages: -------------------------------------------------------------------------------- 1 | # REPO, TAG, IMAGE ID 2 | regexp=^([a-z]+\/?[^\s]+)\s+([^\s]+)\s+(\w+) 3 | colours=default,bold white,bright_cyan,bright_black 4 | ===== 5 | # latest 6 | regexp=(?<=\s)latest(?=\s+) 7 | colours=dark cyan 8 | ===== 9 | # REPOSITORY (Image name) 10 | regexp=^(?:(\S+)\/)*(\S+)\s 11 | colours=default,yellow,bright_white 12 | ===== 13 | # images without name 14 | regexp=^.*$ 15 | colours=bold red 16 | ===== 17 | # images without tag 18 | regexp=\s+()\s+ 19 | colours=unchanged,bold red 20 | ===== 21 | # Size 'K' 22 | regexp=(?<=\s)\d+[.,]?\d*\s?(KB?|B) 23 | colours=green 24 | ====== 25 | # Size 'M', 2 digits 26 | regexp=(?<=\s)\d{1,2}[.,]?\d*\s?MB? 27 | colours=green 28 | ====== 29 | # Size 'M' 3+ digits 30 | regexp=(?<=\s)\d{3,4}[.,]?\d*\s?MB? 31 | colours=yellow 32 | ====== 33 | # Size 'G' 34 | regexp=(?<=\s)\d+[.,]?\d*\s?GB? 35 | colours=red 36 | ===== 37 | # CREATED seconds/minutes 38 | regexp=[\da-f]{12}\s+((?:About a|\d+) (?:seconds?|minutes?) ago) 39 | colours=unchanged,on_green bold white 40 | ====== 41 | # CREATED About a minute ago 42 | regexp=\s+(About a minute ago)\s\w+ 43 | colours=unchanged,on_green bold white 44 | ====== 45 | # CREATED hours 46 | regexp=\s+(\d+\shours\s\w+) 47 | colours=unchanged,bright_green 48 | ====== 49 | # CREATED days 50 | regexp=\s+(\d+\sdays\s\w+) 51 | colours=unchanged,green 52 | ====== 53 | # CREATED weeks 54 | regexp=\s+(\d+\sweeks\s\w+) 55 | colours=unchanged,yellow 56 | ====== 57 | # CREATED months 58 | regexp=\s+(\d+\smonths\s\w+) 59 | colours=unchanged,red 60 | ===== 61 | # HEADERS 62 | regexp=(?:\s|^)(REPOSITORY|TAG|IMAGE ID|CREATED|SIZE)(?:\s|$) 63 | colours=default,underline 64 | -------------------------------------------------------------------------------- /colourfiles/conf.dockerinfo: -------------------------------------------------------------------------------- 1 | # Main Nodes 2 | regexp=^(\S[^:]+):\s?(.*)?$ 3 | colours=default,cyan 4 | ====== 5 | # Sub Nodes 6 | regexp=^\s([^:]+):\s?(.*)?$ 7 | colours=default,magenta 8 | ====== 9 | # Warning 10 | regexp=WARNING:\s(.+)$ 11 | colours=bold yellow, yellow 12 | ====== 13 | # devicemapper 14 | regexp=devicemapper$ 15 | colours=bright_red 16 | - 17 | # loop-lvm 18 | regexp=: (/var/lib/docker/devicemapper/devicemapper/(?:meta)?data) 19 | colours=default,bright_red 20 | -------------------------------------------------------------------------------- /colourfiles/conf.dockernetwork: -------------------------------------------------------------------------------- 1 | # HEADERS 2 | regexp=(?:\s|^)(NETWORK ID|NAME|DRIVER|SCOPE)(?:\s|$) 3 | colours=default,underline 4 | - 5 | # Line 6 | regexp=^(?!NETWORK)(\S+)\s+(\S+) 7 | colours=unchanged,bright_black,bright_blue 8 | - 9 | # Driver BRIDGE 10 | regexp=^\S+\s+\S+\s+(bridge) 11 | colours=unchanged,bright_cyan 12 | - 13 | # Driver HOST 14 | regexp=^\S+\s+\S+\s+(host) 15 | colours=unchanged,cyan 16 | - 17 | # Driver OVERLAY 18 | regexp=^\S+\s+\S+\s+(overlay) 19 | colours=unchanged,magenta 20 | - 21 | # Driver NULL 22 | regexp=^\S+\s+\S+\s+(null) 23 | colours=unchanged,on_red white 24 | -------------------------------------------------------------------------------- /colourfiles/conf.dockerps: -------------------------------------------------------------------------------- 1 | # HEADERS 2 | regexp=(?:\s|^)(CONTAINER ID|IMAGE|COMMAND|CREATED|STATUS|PORTS|NAMES)(?:\s|$) 3 | colours=default,underline 4 | ====== 5 | # IMAGE NAME (as docker image) 6 | regexp=\s{2,}(?:([a-z\-_0-9]+)\/)*([a-z\-_0-9]+)(:\S+)?\s{2,}\" 7 | colours=unchanged,yellow,bright_white,cyan 8 | ====== 9 | # IMAGE 10 | regexp=^(?!CONTAINER)(\w+)\s+([^\s]+)\s+(".*")\s+(.*(?=(?:Up|Exited|Created|Restarting))) 11 | colours=unchanged,bright_black,unchanged,bright_black,cyan 12 | ====== 13 | # Statuses - Created 14 | regexp=\sCreated\s 15 | colours=blue 16 | ====== 17 | # Statuses 18 | # https://github.com/docker/docker/blob/e5a3f86e447dd659da3c2e759f3c088a0bfcfe3d/container/state.go#L40 19 | # Up 20 | regexp=(?:\s{2}|^)(?:Up|Restarting)(?:(?:\s[\w,\d]+)+)? 21 | colours=bold green 22 | ====== 23 | # Health - healthy 24 | regexp=\s\(healthy\) 25 | colours=bold green 26 | ====== 27 | # Health - starting 28 | regexp=\s\(health: starting\) 29 | colours=bold yellow 30 | ====== 31 | # Health - unhealthy 32 | regexp=\s\(unhealthy\) 33 | colours=bold red 34 | ====== 35 | # Statuses - Exited 36 | regexp=Exited\s.(\d+).+?(?=\s{2,}) 37 | colours=bold red,red 38 | ====== 39 | # Statuses - Restarting 40 | regexp=Restarting\s.(\d+).+?(?=\s{2,}) 41 | colours=bold blue 42 | ====== 43 | # Ip Addresses 44 | regexp=(\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3})(\:)? 45 | colours=default,blue,default 46 | ====== 47 | # Ports 48 | regexp=(\d{1,5})?(-)?(\d{1,5})?(->)?(\d{1,5})(-)?(\d{1,5})?(\/)(tcp|udp) 49 | colours=default,bright_green,default,bright_green, default, bright_green,default,bright_green,default,cyan 50 | ====== 51 | # NAMES 52 | regexp=(?:([a-z\-_0-9]+)\/)*([a-z\-_0-9]+)$ 53 | colours=default,yellow,on_blue white 54 | -------------------------------------------------------------------------------- /colourfiles/conf.dockerpull: -------------------------------------------------------------------------------- 1 | # Header 2 | regexp=Using default tag: (\w+) 3 | colours=default,bold yellow 4 | ====== 5 | # Image 6 | regexp=Pulling from ([^\s]+) 7 | colours=default,bold green 8 | ====== 9 | # HASH 10 | regexp=^\w{12}: 11 | colours=default 12 | ====== 13 | # 1_Pulling fs layer 14 | regexp=Pulling fs layer 15 | colours=yellow 16 | ====== 17 | # 2_Waiting 18 | regexp=Waiting 19 | colours=bright_yellow 20 | ====== 21 | # 3_Verifying Checksum 22 | regexp=Verifying Checksum 23 | colours=bold yellow 24 | ====== 25 | # 4_Download complete 26 | regexp=Download complete 27 | colours=green 28 | ====== 29 | # 5_Pull Complete 30 | regexp=Pull complete 31 | colours=bold green 32 | ====== 33 | # Already exists 34 | regexp=Already exists 35 | colours=blue 36 | ====== 37 | # Status Updated 38 | regexp=Image is up to date 39 | colours=bold green 40 | ====== 41 | # Status Downloaded 42 | regexp=Downloaded newer image 43 | colours=bold blue 44 | -------------------------------------------------------------------------------- /colourfiles/conf.dockersearch: -------------------------------------------------------------------------------- 1 | # NAMES 2 | regexp=^(?:([a-z\-_0-9]+)\/)*(\S+)\s(?!DESCRIPTION) 3 | colours=default,yellow,bold yellow 4 | - 5 | # Title 6 | regexp=^NAME.* 7 | colours=default 8 | - 9 | # Oficial 10 | regexp=\[OK\](?!$) 11 | colours=bold green 12 | - 13 | # Automated 14 | regexp=\[OK\]$ 15 | colours=magenta 16 | - 17 | # 1 digit Star 18 | regexp=\s{3,}(\d)\s{3,} 19 | colours=red 20 | - 21 | # 2 digits Stars 22 | regexp=\s{3,}(\d{2})\s{3,} 23 | colours=yellow 24 | - 25 | # 3 digits Stars 26 | regexp=\s{3,}(\d{3,})\s{3,} 27 | colours=green 28 | -------------------------------------------------------------------------------- /colourfiles/conf.dockerversion: -------------------------------------------------------------------------------- 1 | # Values 2 | regexp=^\s([^:]+):(.+)$ 3 | colours=default,cyan 4 | ====== 5 | # Client 6 | regexp=^(Client): 7 | colours=default,bold cyan 8 | ====== 9 | # Server 10 | regexp=^(Server): 11 | colours=default,bold green 12 | -------------------------------------------------------------------------------- /colourfiles/conf.du: -------------------------------------------------------------------------------- 1 | # Cannot read STDERR, not working 2 | regexp=^du.* 3 | colours=red 4 | ====== 5 | # Path 6 | regexp=\s+[\.\/]+([\w\s\-\_\.]+)(\/.*)?$ 7 | colours=default,bold blue,blue 8 | ====== 9 | # Size 'K' 10 | regexp=^\d{1,3}\s 11 | colours=green 12 | ====== 13 | regexp=^ ?\d*[.,]?\dKi?\s 14 | colours=green 15 | ====== 16 | # Size 'M' 17 | regexp=^\d{4,6}\s 18 | colours=yellow 19 | ====== 20 | regexp=^ ?\d*[.,]?\dMi?\s 21 | colours=yellow 22 | ====== 23 | # Size 'G' 24 | regexp=^\d{7,9}\s 25 | colours=red 26 | ====== 27 | regexp=^ ?\d*[.,]?\dGi?\s 28 | colours=red 29 | ====== 30 | # Size 'T' 31 | regexp=^\d{10,12}\s 32 | colours=bold red 33 | ====== 34 | regexp=^ ?\d*[.,]?\dTi?\s 35 | colours=bold red 36 | ====== 37 | # Total 38 | regexp=(.*)\s+(total)$ 39 | colours=bold yellow on_blue 40 | -------------------------------------------------------------------------------- /colourfiles/conf.dummy: -------------------------------------------------------------------------------- 1 | # for testing purposes, do match but do not change anything 2 | regexp=([a-g]+) 3 | colour='' 4 | 5 | -------------------------------------------------------------------------------- /colourfiles/conf.env: -------------------------------------------------------------------------------- 1 | # Main 2 | regexp=^([^=]+)(=)(.*)$ 3 | colours=default,cyan,white,yellow 4 | -------------------------------------------------------------------------------- /colourfiles/conf.esperanto: -------------------------------------------------------------------------------- 1 | # cxi tia dosiero estas treege nekompleta kaj nur mallonga ekzemplo 2 | # kial skribi regulojn por kolorigo de tekstoj 3 | # 4 | # substantivoj 5 | regexp=(?i)\b\w+(?=(o|oj|on|ojn)\b) 6 | colours=green 7 | 8 | %%%%%%% 9 | 10 | # sufiksoj de substantivoj 11 | regexp=(?i)o(|j|n|jn)\b 12 | colours=yellow 13 | 14 | %%%%%%% 15 | 16 | # verboj 17 | regexp=\b\w+(?=(?i)i|as|is|os|u)\b 18 | colours=magenta 19 | 20 | %%%%%%% 21 | 22 | # sufiksoj de verboj 23 | regexp=(?i)(i|as|is|os|u)\b 24 | colours=yellow 25 | 26 | %%%%%%% 27 | 28 | # adverboj 29 | regexp=(?i)\b\w+(?=e\b) 30 | colours=bold magenta 31 | 32 | %%%%%%% 33 | 34 | # sufiksoj de adverboj 35 | regexp=(?i)(e|aux)\b 36 | colours=yellow 37 | 38 | %%%%%%% 39 | 40 | # adjektivoj 41 | regexp=(?i)\b\w+(?=(a|aj|an|ajn)\b) 42 | colours=blue 43 | 44 | %%%%%%% 45 | 46 | # sufiksoj de adjektivoj 47 | regexp=(?i)a(j|n|jn)\b 48 | colours=yellow 49 | 50 | %%%%%%% 51 | 52 | # kelkaj kurtaj vortoj 53 | regexp=(?i)\b(de|en|kun|sen|la|pli|plej|plu)\b 54 | colours=bold yellow 55 | -------------------------------------------------------------------------------- /colourfiles/conf.fdisk: -------------------------------------------------------------------------------- 1 | # Error 2 | regexp=fdisk: cannot open ([^:]+).*$ 3 | colours=red, bold red 4 | - 5 | # Disk 6 | regexp=^(Disk) (?:\/([^\/: ]+))+ 7 | colours=yellow,on_yellow black,bold yellow 8 | - 9 | # Boot? 10 | regexp=\*\s\s\s 11 | colours=on_red bold white 12 | - 13 | # Partitions 14 | regexp=^(?:\/([^\/: ]+))+ 15 | colours=green,bold green 16 | - 17 | # Type 18 | regexp=type: (.*)$ 19 | colours=unchanged,bold cyan 20 | - 21 | # ID 22 | regexp=identifier: (.*)$ 23 | colours=unchanged, cyan 24 | - 25 | # Size 'K' 26 | regexp=\s\d*[.,]?\d*\s?Ki?B? 27 | colours=green 28 | - 29 | # Size 'M' 30 | regexp=\s\d*[.,]?\d*\s?Mi?B? 31 | colours=yellow 32 | - 33 | # Size 'G' 34 | regexp=\s\d+[.,]?\d*\s?Gi?B? 35 | colours=red 36 | -------------------------------------------------------------------------------- /colourfiles/conf.findmnt: -------------------------------------------------------------------------------- 1 | # Devices 2 | regexp=\s\/dev(?:\/([^\/ ]+))+ 3 | colours=green, bold green 4 | - 5 | # Mount Path 6 | regexp=(?<=─|-)(?:\/([^\/ ]+))+ 7 | colours=unchanged,bold yellow 8 | - 9 | # RW 10 | regexp=(?:\s)rw 11 | colours=bold red 12 | - 13 | # RO 14 | regexp=(?:\s)ro 15 | colours=bold green 16 | - 17 | # Like comment, leave at end always 18 | regexp=^.*(?=cgroup|tmpfs).*$ 19 | colours=bright_black 20 | - 21 | # Common Types 22 | regexp=\b(ext\d|xfs|btrfs|nfs)\b 23 | colours=cyan 24 | - 25 | # MS Types 26 | regexp=\b(fat|vfat|ntfs|msdos)\b 27 | colours=on_cyan white 28 | -------------------------------------------------------------------------------- /colourfiles/conf.free: -------------------------------------------------------------------------------- 1 | # Size 'K' 2 | regexp=\s\d*[.,]?\dKi?|\b\d{1,3}\b 3 | colours=green 4 | ====== 5 | # Size 'M' 6 | regexp=\s\d*[.,]?\dMi?|\b\d{4,6}\b 7 | colours=yellow 8 | ====== 9 | # Size 'G' 10 | regexp=\s\d*[.,]?\dGi?|\b\d{7,9}\b 11 | colours=red 12 | ====== 13 | # Size 'T' 14 | regexp=\s\d*[.,]?\dTi?|\b\d{10,12}\b 15 | colours=bold red 16 | ====== 17 | # Mem 18 | regexp=^Mem 19 | colours=bold cyan 20 | ====== 21 | # Swap 22 | regexp=^Swap 23 | colours=bold magenta 24 | ====== 25 | # Zero 26 | regexp=\s+0\w?(\s|$) 27 | colours=green 28 | -------------------------------------------------------------------------------- /colourfiles/conf.gcc: -------------------------------------------------------------------------------- 1 | # 2 | regexp=\b(g?cc|[gc]\+\+|g?as|ld)\b 3 | colours=white bold 4 | count=once 5 | ......... 6 | # 7 | regexp=^[^:\s]*?:\d+: 8 | colours=bold magenta 9 | ......... 10 | regexp=^[^:\s]*?: 11 | colours=cyan 12 | count=once 13 | ......... 14 | # 15 | regexp=\`[A-Za-z0-9_():&*]+( const)?\' 16 | colours=magenta 17 | ......... 18 | # compilation method modifiers 19 | regexp=\s\-(O\d?|f\S+|pthread|g\S*|c|W\S,\S+)\b 20 | colours=yellow 21 | ......... 22 | # -O 23 | regexp=\-O\d 24 | colours=green 25 | ......... 26 | # -o 27 | regexp=\-o\s[^\s]+ 28 | colours=yellow 29 | ......... 30 | # warning and error won't work, unless you redirect also 31 | # stderr to grcat 32 | # 33 | # warning 34 | regexp=[Ww]arning[:\b] 35 | colours=white 36 | ......... 37 | regexp=warning: 38 | colours=bold yellow 39 | count=once 40 | ......... 41 | # error 42 | regexp=[Ee]rror[:\b] 43 | colours=bold white 44 | ......... 45 | regexp=error: 46 | colours=bold white on_red 47 | count=once 48 | ......... 49 | #note 50 | regexp=note: 51 | colours=bold cyan 52 | count=once 53 | -------------------------------------------------------------------------------- /colourfiles/conf.getfacl: -------------------------------------------------------------------------------- 1 | # Header file 2 | regexp=^\#\sfile:\s(\S+) 3 | colours=cyan,bold 4 | - 5 | # Header owner 6 | regexp=^\#\sowner:\s(\S+) 7 | colours=cyan,bold green 8 | - 9 | # Header group 10 | regexp=^\#\sgroup:\s(\S+) 11 | colours=cyan,bold yellow 12 | - 13 | # user 14 | regexp=(?:^|:)user:([^:]+)?:(\S+) 15 | colours=green,on_green black,bright_green 16 | - 17 | # group 18 | regexp=(?:^|:)group:([^:]+)?:(\S+) 19 | colours=yellow,on_yellow black,bright_yellow 20 | - 21 | # other 22 | regexp=(?:^|:)other:([^:]+)?:(\S+) 23 | colours=red,on_red black,bright_red 24 | - 25 | # mask 26 | regexp=(?:^|:)mask:([^:]+)?:(\S+) 27 | colours=blue,on_blue black,bright_blue 28 | - 29 | # default: 30 | regexp=^default 31 | colours=on_blue bold white 32 | -------------------------------------------------------------------------------- /colourfiles/conf.getsebool: -------------------------------------------------------------------------------- 1 | # Name 2 | regexp=^\S+ 3 | colours=default 4 | - 5 | # State 6 | regexp=--> 7 | colours=yellow 8 | - 9 | # State 10 | regexp=\s(off) 11 | colours=default,bright_red 12 | - 13 | # State 14 | regexp=\s(on) 15 | colours=default,bright_green 16 | -------------------------------------------------------------------------------- /colourfiles/conf.go-test: -------------------------------------------------------------------------------- 1 | # go-test grc colorizer configuration 2 | regexp==== RUN .* 3 | colour=bright_blue 4 | - 5 | regexp=--- PASS: .* (\(\d+\.\d+s\)) 6 | colour=green, yellow 7 | - 8 | regexp=^PASS$ 9 | colour=bold white on_green 10 | - 11 | regexp=^(ok|FAIL)\s+.* 12 | colour=default, magenta 13 | - 14 | regexp=--- FAIL: .* (\(\d+\.\d+s\)) 15 | colour=red, yellow 16 | - 17 | regexp=^FAIL$ 18 | colour=bold white on_red 19 | - 20 | regexp=[^\s]+\.go(:\d+)? 21 | colour=cyan 22 | -------------------------------------------------------------------------------- /colourfiles/conf.id: -------------------------------------------------------------------------------- 1 | # Groups 2 | regexp=(\d+)\((\w+)\) 3 | colours=unchanged,yellow,bold yellow 4 | - 5 | # User 6 | regexp=uid.(\d+)\((\w+)\) 7 | colours=unchanged,green,bold green 8 | - 9 | # SELinux 10 | regexp=(\w+_u):(\w+_r):(\w+_t):([\w\-.:]+) 11 | colours=unchanged,green,yellow,cyan,magenta 12 | -------------------------------------------------------------------------------- /colourfiles/conf.ifconfig: -------------------------------------------------------------------------------- 1 | 2 | # ipv4 3 | regexp=\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3} 4 | colours=bold green 5 | ======= 6 | # ipv6 7 | regexp=\b[0-9a-fA-F]{1,4}(\:\:?[0-9a-fA-F]{1,4})+ 8 | colours=bold green 9 | ======= 10 | # hwaddr 11 | regexp=(\d|[a-f]){2}(\:(\d|[a-f]){2}){5} 12 | colours=yellow 13 | ======= 14 | # size 15 | regexp=\d+(\.\d+)?\s(T|G|M|K|)i?B 16 | colours=yellow 17 | ======= 18 | # interface 19 | regexp=^([a-z0-9.]{2,}\d*):?\s 20 | colours=bold green 21 | ======= 22 | #ip disc 23 | regexp=(inet6?|netmask|broadcast) 24 | colours=cyan 25 | ======= 26 | #flags 27 | regexp=(?<=[,<])[^,]+?(?=[,>]) 28 | colours=blue 29 | ======= 30 | # mtu 31 | regexp=(?i)mtu(\s|\:)\d+ 32 | colours=green 33 | ======= 34 | #errors 35 | regexp=errors(\s|\:)\d+ 36 | colours=red 37 | ======= 38 | regexp=dropped(\s|\:)\d+ 39 | colours=white 40 | ======= 41 | regexp=overruns(\s|\:)\d+ 42 | colours=green 43 | ======= 44 | regexp=frame(\s|\:)\d+ 45 | colours=white 46 | ======= 47 | regexp=carrier(\s|\:)\d+ 48 | colours=cyan 49 | ======= 50 | regexp=collisions(\s|\:)\d+ 51 | colours=red 52 | -------------------------------------------------------------------------------- /colourfiles/conf.iostat_sar: -------------------------------------------------------------------------------- 1 | # Devices 2 | regexp=^[\w\d-]+\s{2,}(?!%) 3 | colours=bright_green 4 | - 5 | # Averages Title 6 | regexp=\s+(%user)\s+(%nice)\s+(%system)\s+(%iowait)\s+(%steal)\s+(%idle) 7 | colours=default,blue,cyan,magenta,bright_magenta,red,green 8 | - 9 | # Averages Numbers 10 | regexp=\s+(\d+\.\d+)\s+(\d+\.\d+)\s+(\d+\.\d+)\s+(\d+\.\d+)\s+(\d+\.\d+)\s+(\d+\.\d+) 11 | colours=default,blue,cyan,magenta,bright_magenta,red,green 12 | - 13 | # Averages last line 14 | regexp=^Average:.*$ 15 | colours=reverse 16 | - 17 | # High rates (4 digits) 18 | regexp=\s\d{4}\.\d+ 19 | colours=red 20 | - 21 | # High rates (5+ digits) 22 | regexp=\s\d{5,}\.\d+ 23 | colours=bold red 24 | -------------------------------------------------------------------------------- /colourfiles/conf.ip: -------------------------------------------------------------------------------- 1 | # IP4 2 | regexp=\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3} 3 | colours=bold yellow 4 | - 5 | 6 | # IP6 7 | regexp=[0-9a-fA-F]{0,4}(\:\:?[0-9a-fA-F]{0,4})+?(\/\d{1,3}) 8 | colours=yellow 9 | - 10 | 11 | # MAC 12 | regexp=(\d|[a-f]){2}(\:(\d|[a-f]){2}){5} 13 | colours=magenta 14 | - 15 | 16 | # parenthesis 17 | regexp=\(|\) 18 | colours=yellow 19 | - 20 | 21 | # dev wlan0 etc 22 | regexp=dev \w+ 23 | colours=yellow 24 | - 25 | 26 | # "default" 27 | regexp=default 28 | colours=on_blue 29 | - 30 | 31 | # ip range size 32 | regexp=/\d{1,2} 33 | colours=red 34 | - 35 | 36 | # "linkdown" 37 | regexp=linkdown 38 | colours=bold red 39 | - 40 | 41 | # "src" 42 | regexp=src \S+ 43 | colours=on_magenta 44 | 45 | -------------------------------------------------------------------------------- /colourfiles/conf.ipaddr: -------------------------------------------------------------------------------- 1 | # IP4 2 | regexp=inet\s([^\/]+)\/(\d+) 3 | colours=default,bold yellow,bold magenta 4 | ===== 5 | # broadcast 6 | regexp=brd\s([^}\s]+) 7 | colours=default,dark cyan 8 | ===== 9 | # dynamic 10 | regexp=\bdynamic\b 11 | colours=dark green 12 | ===== 13 | # IP6 14 | regexp=inet6\s([^\/]+)\/(\d+) 15 | colours=default,yellow,magenta 16 | ===== 17 | # MAC 18 | regexp=link\/ether\s(\S+)\s 19 | colours=default,magenta 20 | ===== 21 | # State UP 22 | regexp=(\d+):\s(\S+):.+state (UP) 23 | colours=default,bright_white,bold green,bold green 24 | ===== 25 | # State DOWN 26 | regexp=(\d+):\s(\S+):.+state (DOWN) 27 | colours=default,bright_white,bold red,bold red 28 | ===== 29 | # State UNKNOWN 30 | regexp=(\d+):\s(\S+):.+state (UNKNOWN) 31 | colours=default,bright_white,bold cyan,cyan 32 | ===== 33 | # State DORMANT 34 | regexp=(\d+):\s(\S+):.+state (DORMANT) 35 | colours=default,bright_white,bold cyan,cyan 36 | ===== 37 | # < > 38 | regexp=\s<([^>]+)> 39 | colours=default,cyan 40 | ===== 41 | # NO-CARRIER 42 | regexp=NO-CARRIER 43 | colours=bold red 44 | ===== 45 | # Master dev 46 | regexp=\smaster\s(\S+)\s 47 | colours=default,on_blue white 48 | ===== 49 | # on 50 | regexp=\son\s 51 | colours=green 52 | ===== 53 | # off 54 | regexp=\soff\s 55 | colours=dark red 56 | ===== 57 | # link/none 58 | regexp=link\/(none) 59 | colours=unchanged,red 60 | -------------------------------------------------------------------------------- /colourfiles/conf.ipneighbor: -------------------------------------------------------------------------------- 1 | # STATUS - STALE 2 | regexp=^(\S+)\s.*(STALE)$ 3 | colours=default,bright_red,bold red 4 | - 5 | # STATUS - FAILED 6 | regexp=^(\S+)\s.*(FAILED)$ 7 | colours=default,bright_magenta,bold magenta 8 | - 9 | # Status - REACHABLE 10 | regexp=^(\S+)\s.*(REACHABLE)$ 11 | colours=default,bright_green,green 12 | - 13 | # Status - DELAY 14 | regexp=^(\S+)\s.*(DELAY)$ 15 | colours=default,bright_yellow,yellow 16 | - 17 | # DEV 18 | regexp=dev\s(\S+) 19 | colours=default,cyan 20 | -------------------------------------------------------------------------------- /colourfiles/conf.iproute: -------------------------------------------------------------------------------- 1 | # DEV 2 | regexp=dev\s(\S+) 3 | colours=default,cyan 4 | ===== 5 | # Gateway 6 | regexp=(via)\s(\S+)\s 7 | colours=default,yellow,bold yellow 8 | ===== 9 | # Network 10 | regexp=^(default|[^ \/]+(\/(\d+))?) 11 | colours=green,bright_green,default,green 12 | ===== 13 | # Network DEFAULT 14 | regexp=^default 15 | colours=on_green bold white 16 | ===== 17 | # Local 18 | regexp=(src)\s(\S+)\s? 19 | colours=default,magenta,bold magenta 20 | ===== 21 | # proto 22 | regexp=(proto)\s(\S+)\s 23 | colours=default,default,dark yellow 24 | ===== 25 | # metric 26 | regexp=(metric)\s(\d+)\b 27 | colours=default,default,bold white 28 | ===== 29 | # linkdown 30 | regexp=linkdown 31 | colours=bold red 32 | -------------------------------------------------------------------------------- /colourfiles/conf.iptables: -------------------------------------------------------------------------------- 1 | # Chains Custom name 2 | regexp=^Chain\s(\S+)\s\(.*$ 3 | colours=white, bold bright_blue 4 | - 5 | # Chains FILTER table 6 | regexp=^Chain\s(INPUT|OUTPUT|FORWARD)\s 7 | colours=unchanged, bold yellow 8 | - 9 | # Chains NAT|MANGLE table 10 | regexp=^Chain\s(PREROUTING|POSTROUTING|INPUT|OUTPUT)\s 11 | colours=unchanged, bold yellow 12 | - 13 | # 2row Title 14 | regexp=(pkts|target|num).* 15 | colours=bold black 16 | - 17 | # JUMP Destiny ---------------------------------------------------------------- 18 | regexp=ACCEPT 19 | colours=bright_green 20 | - 21 | regexp=DROP 22 | colours=bright_red 23 | - 24 | regexp=REJECT 25 | colours=red 26 | - 27 | regexp=QUEUE 28 | colours=on_red white 29 | - 30 | regexp=RETURN 31 | colours=on_green white 32 | - 33 | regexp=MASQUERADE 34 | colours=bright_magenta 35 | - 36 | regexp=(LOG|ULOG) 37 | colours=bright_cyan 38 | - 39 | regexp=DNAT 40 | colours=magenta 41 | - 42 | regexp=SNAT 43 | colours=dark magenta 44 | # ------------------------------------------------------------------------------ 45 | - 46 | # tcp 47 | regexp=\stcp\s 48 | colours=bold cyan 49 | - 50 | # udp 51 | regexp=\sudp\s 52 | colours=bold magenta 53 | - 54 | # icmp 55 | regexp=\sicmp\s 56 | colours=cyan 57 | - 58 | # all 59 | regexp=\sall\s 60 | colours=red 61 | - 62 | # dpt 63 | regexp=\sdpts?:([^\s]*)(\s|$) 64 | colours=default,bold yellow 65 | - 66 | # Goto 67 | regexp=\s(\[goto\]) 68 | colours=default,on_blue bold white 69 | - 70 | # masq ports 71 | regexp=\smasq ports:\s(\d+)-?(\d+)? 72 | colours=default,bold yellow,bold yellow 73 | - 74 | # ctstate 75 | regexp=ctstate\s(\S+) 76 | colours=default,blue 77 | - 78 | # IP 79 | regexp=(!)?((?:\d{1,3}\.){3}(?:\d{1,3}))(?:\/|:)?(\d+)? 80 | colours=default,red,bright_white,magenta 81 | - 82 | # anywhere 83 | regexp=\s(anywhere|0.0.0.0/0)\s 84 | colours=bright_black 85 | - 86 | # (Num references) 87 | regexp=\((\d+) references\) 88 | colours=default,bright_green 89 | -------------------------------------------------------------------------------- /colourfiles/conf.irclog: -------------------------------------------------------------------------------- 1 | # ip number 2 | regexp=\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3} 3 | colours=magenta 4 | ======= 5 | # *** 6 | regexp=\*\*\* 7 | colours=bold green 8 | ======= 9 | # +++ 10 | regexp=\+\+\+ 11 | colours=green 12 | ======= 13 | # mail address 14 | regexp=\S+\@[\w\-\.]+ 15 | colours=bold yellow 16 | ======= 17 | # Signoff 18 | regexp=Signoff 19 | colours=bold red 20 | ======= 21 | # Signon 22 | regexp=Signon 23 | colours=bold green 24 | ======= 25 | # everything in parentheses 26 | regexp=\(.+?\) 27 | colours=green 28 | count=more 29 | ======= 30 | # channel name 31 | regexp=\#[\w\-\.]+ 32 | colours=bold blue 33 | -------------------------------------------------------------------------------- /colourfiles/conf.iwconfig: -------------------------------------------------------------------------------- 1 | # no wireless extensions 2 | regexp=\bno wireless extensions 3 | colours=red 4 | ======= 5 | # Frequency 6 | regexp=[0-9\.]{1,10} GHz 7 | colours=bold green 8 | ======= 9 | # Type 10 | regexp=802\.11([a-z]+) 11 | colours=bold yellow 12 | ======= 13 | # Speed 14 | regexp=[0-9\.]+ Mb/s 15 | colours=bold yellow 16 | ======= 17 | # Tx-Power 18 | regexp=\-?[0-9]+ dBm 19 | colours=bold green 20 | ======= 21 | # ipv4 22 | regexp=\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3} 23 | colours=bold green 24 | ======= 25 | # ipv6 26 | regexp=\b[0-9a-fA-F]{1,4}(\:\:?[0-9a-fA-F]{1,4})+ 27 | colours=bold green 28 | ======= 29 | # hwaddr 30 | regexp=(\d|[a-f]){2}(\:(\d|[a-f]){2}){5} 31 | colours=yellow 32 | ======= 33 | # size 34 | regexp=\d+(\.\d+)?\s(T|G|M|K|)i?B 35 | colours=yellow 36 | ======= 37 | # interface 38 | regexp=^([a-z0-9]{2,}\d*):?\s 39 | colours=bold green 40 | ======= 41 | #ip disc 42 | regexp=(inet6?|netmask|broadcast) 43 | colours=cyan 44 | ======= 45 | #flags 46 | regexp=(?<=[,<])[^,]+?(?=[,>]) 47 | colours=blue 48 | ======= 49 | # mtu 50 | regexp=(?i)mtu(\s|\:)\d+ 51 | colours=green 52 | ======= 53 | # quality/level/sensitivity 54 | regexp=(\d+/\d+) 55 | colours=bold yellow 56 | ======= 57 | #errors 58 | regexp=errors(\s|\:)\d+ 59 | colours=red 60 | ======= 61 | regexp=dropped(\s|\:)\d+ 62 | colours=white 63 | ======= 64 | regexp=overruns(\s|\:)\d+ 65 | colours=green 66 | ======= 67 | regexp=frame(\s|\:)\d+ 68 | colours=white 69 | ======= 70 | regexp=carrier(\s|\:)\d+ 71 | colours=cyan 72 | ======= 73 | regexp=collisions(\s|\:)\d+ 74 | colours=red 75 | -------------------------------------------------------------------------------- /colourfiles/conf.jobs: -------------------------------------------------------------------------------- 1 | # BASH 2 | regexp=\[(\d+)\](.) +(\d+)?\s? 3 | colour=unchanged, cyan, yellow, magenta 4 | - 5 | regexp=Running.* 6 | colour=bold green 7 | - 8 | regexp=Stopped.* 9 | colour=red 10 | -------------------------------------------------------------------------------- /colourfiles/conf.kubectl: -------------------------------------------------------------------------------- 1 | # Green Words 2 | regexp=\b(Ready|Running|[Tt]rue|Active|Available|Approved|created)\b 3 | colour=unchanged,green 4 | - 5 | # Master 6 | regexp=\smaster\s 7 | colour=on_green bold white 8 | - 9 | # Red Words 10 | regexp=\b([Dd]isabled?|[Ee]rrors?|[Ss]topped|[Ff]alse|none|ErrImagePull|[a-zA-Z]+BackOff|OOMKilled|[Tt]erminated|[Ff]aile?d?)\b 11 | colour=unchanged,red 12 | - 13 | # Yellow Words 14 | regexp=\b([Ww]arning|[Pp]ending|[Ww]aiting|ContainerCreating|Released|Bound|already exists)\b 15 | colour=unchanged,yellow 16 | - 17 | # Completed Jobs 18 | regexp=\b(Completed)\b 19 | colour=unchanged,dark green 20 | - 21 | # Misc IP 22 | regexp=\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}(/\d{1,2})? 23 | colour=cyan,magenta 24 | - 25 | # Ports 26 | regexp=(\d+)(:\d+)?/(TCP|UDP) 27 | colour=unchanged,yellow,bold green,magenta 28 | - 29 | # Type/Name 30 | regexp=^([^/ ]+)/(\S+) 31 | colour=unchanged,yellow,bright_white 32 | - 33 | # No running Instances 34 | regexp=\s(0/[1-9]+)\b 35 | colour=unchanged,bold red 36 | - 37 | # Labels 38 | regexp=([\w\d\-_\/.]+)=([\w\d\-_./]+)(,| |$) 39 | colour=unchanged,blue,bright_yellow 40 | - 41 | # YAML First level (PSEUDO) 42 | regexp=^([\w\d \-]+): 43 | colours=unchanged,bright_blue 44 | - 45 | # YAML Nested 46 | regexp=^[ \-]+(\S+): 47 | colours=unchanged, blue 48 | - 49 | # YAML number 50 | regexp=: (\d+)$ 51 | colours=unchanged, yellow 52 | - 53 | # Explicit String 54 | regexp="(\S*)(?=") 55 | colours=default,cyan 56 | - 57 | # Empy 58 | regexp=(\?|null) 59 | colours=magenta 60 | - 61 | # Events title 62 | regexp=\s+(Type)\s+(Reason)\s+(Age)\s+(From)\s+(Message) 63 | colours=cyan, cyan, cyan, cyan, cyan, magenta 64 | - 65 | # Title separator 66 | regexp=\s+\-{3,} 67 | colours=dark white 68 | - 69 | # HELP Highlight 70 | regexp=( --[^= ]+| -[a-zA-Z]( |,)) 71 | colour=bright_green 72 | - 73 | # Higlight (Tested in kubectl config get-contexts) 74 | regexp=^\*.+$ 75 | colour=bold white 76 | -------------------------------------------------------------------------------- /colourfiles/conf.last: -------------------------------------------------------------------------------- 1 | # DateTime 2 | regexp=\s(\w{3})\s(\w{3})\s+(\d{1,2})\s(\d+:\d+)\s 3 | colours=default,default,default,default,cyan 4 | ===== 5 | # DateTime end 6 | regexp=\s-\s(\d+:\d+) 7 | colours=default,magenta 8 | ===== 9 | # DateTime - down 10 | regexp=\s-\s(down) 11 | colours=default, red 12 | ===== 13 | # DateTime - crash 14 | regexp=\s-\s(crash) 15 | colours=default, on_red white 16 | ===== 17 | # still logged in 18 | regexp=still logged in 19 | colours=on_cyan bold white 20 | ===== 21 | # still running 22 | regexp=still running 23 | colours=bright_green 24 | ===== 25 | # Time 26 | regexp=\((\d+\+)?(\d+):(\d+)\) 27 | colours=default,bright_red,yellow,green 28 | ===== 29 | # pts 30 | regexp=\s(pts[\S]+) 31 | colours=default,green 32 | ===== 33 | # tty 34 | regexp=\s(tty\d) 35 | colours=default,blue 36 | ===== 37 | # reboot 38 | regexp=^reboot\s+system boot 39 | colours=red 40 | ===== 41 | # Third column IP 42 | regexp=(?:\s|\()(\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3})(?:\s|\)) 43 | colours=default,bold red 44 | ===== 45 | # Third column local 46 | regexp=(?:\s|\()(\:0)(?:\s|\)) 47 | colours=default,dark cyan 48 | -------------------------------------------------------------------------------- /colourfiles/conf.ldap: -------------------------------------------------------------------------------- 1 | # Intended for colouring LDIF output (from ldap tools) 2 | # comments 3 | regexp=^#.* 4 | colours=green 5 | count=stop 6 | - 7 | # meta 8 | regexp=^(version|search|result): 9 | colours=red 10 | count=stop 11 | - 12 | # "attribute: value" pairs 13 | regexp=^.*?: 14 | colours=blue 15 | count=stop 16 | -------------------------------------------------------------------------------- /colourfiles/conf.log: -------------------------------------------------------------------------------- 1 | # this configuration file is suitable for displaying kernel log files 2 | 3 | 4 | # example of text substitution 5 | #regexp=\bda?emon 6 | #replace=angel 7 | #colours=red 8 | #====== 9 | # example of text substitution 10 | #regexp=(\d\d):(\d\d):(\d\d) 11 | #replace=\1h\2m\3s 12 | #====== 13 | 14 | # display this line in yellow and stop further processing 15 | regexp=.*last message repeated \d+ times$ 16 | colours=yellow 17 | count=stop 18 | ====== 19 | # this is date and hostname 20 | # 'Jun 3 22:44:55 neutronium ' 21 | # 'Jun 3 22:44:55 neutronium-02.my-domain.io ' 22 | regexp=^... (\d| )\d \d\d:\d\d:\d\d(\s[-.\w\d]+?\s) 23 | colours=green, green, red 24 | count=once 25 | ====== 26 | # everything in parentheses 27 | regexp=\(.*?\) 28 | colours=blue 29 | count=more 30 | ====== 31 | # everything in `' 32 | regexp=\`.+?\' 33 | colours=bold yellow 34 | count=more 35 | ====== 36 | # everything in " 37 | regexp=\".*?\" 38 | colours=blue 39 | ====== 40 | # this is probably a pathname 41 | regexp=\s/[a-zA-Z_/\.\-\?\d\=\&]+ 42 | colours=blue 43 | count=more 44 | ====== 45 | # everything in <> 46 | regexp=\<.*?\> 47 | colours=blue 48 | count=more 49 | ====== 50 | # name of process and pid 51 | regexp=([\w/\.\-]+)(\[\d+?\]) 52 | colours=bold blue, bold red 53 | count=more 54 | ====== 55 | # IPv4 or IPv4:Port 56 | regexp=\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}(:\d{1,5})? 57 | colours=bold yellow 58 | count=more 59 | ====== 60 | # IPv6 61 | regexp=(([0-9a-fA-F]{1,4})?\:\:?[0-9a-fA-F]{1,4})+ 62 | colours=bold yellow 63 | ======= 64 | # Email address 65 | regexp=[a-zA-z0-9\.\-\+]+\@[\w\-\.]+ 66 | colours=green 67 | ====== 68 | # HTTP verbs 69 | regexp=GET|POST|PUT|DELETE|PATCH|HEAD 70 | colours=green 71 | ====== 72 | # 2xx status 73 | regexp=\s\b2\d{2}\b\s 74 | colours=green 75 | ====== 76 | # 3xx status 77 | regexp=\s\b3\d{2}\b\s 78 | colours=yellow 79 | ====== 80 | # 4xx status 81 | regexp=\s\b4\d{2}\b\s 82 | colours=red 83 | ====== 84 | # 5xx status 85 | regexp=\s\b5\d{2}\b\s 86 | colours=red 87 | ====== 88 | # status deferred 89 | regexp=status\=deferred|Connection refused 90 | colours=red 91 | ====== 92 | # connect requires special attention 93 | regexp=connect 94 | colours=on_red 95 | count=more 96 | -------------------------------------------------------------------------------- /colourfiles/conf.lolcat: -------------------------------------------------------------------------------- 1 | #Message 2 | regexp=([^\w\d]+) 3 | colours=unchanged 4 | ====== 5 | regexp=([a-zA-Z0-9]+) 6 | colours=default,green,yellow,red 7 | 8 | -------------------------------------------------------------------------------- /colourfiles/conf.ls: -------------------------------------------------------------------------------- 1 | # The following matches file sizes as produced by ls -l or ls -lh 2 | # The output produced by ls -s is probably not specific 3 | # enough to be reliably matched, especially considering ls -s(k|m|g|G). 4 | # 5 | # Example lines: 6 | # -rw-r--r-- 1 user staff 344M Mar 22 22:51 MVI_8735.m4v 7 | # -rw-r--r-- 1 user staff 360050327 Mar 22 22:51 MVI_8735.m4v 8 | # -rw-r--r--. 1 user staff 1.0G Nov 23 16:13 testg 9 | # -rw-r--r--. 1 user staff 1.0K Nov 23 16:13 testk 10 | # -rw-r--r--. 1 user staff 1.0M Nov 23 16:13 testm 11 | # -rw-r--r--. 1 user staff 1073741824 Nov 23 16:13 testg 12 | # -rw-r--r--. 1 user staff 1024 Nov 23 16:13 testk 13 | # -rw-r--r--. 1 user staff 1048576 Nov 23 16:13 testm 14 | # 15 | # The regexp uses lookahead to match a date following the size 16 | 17 | # size: 1M <= size < 10M 18 | regexp=\s+(\d{7}|\d(?:[,.]?\d+)?[KM])(?=\s[A-Z][a-z]{2}\s) 19 | colours=green 20 | ======= 21 | # size: 10M <= size < 100M 22 | regexp=\s+(\d{8}|\d\d(?:[,.]?\d+)?M)(?=\s[A-Z][a-z]{2}\s) 23 | colours=yellow 24 | ======= 25 | # size: 100M <= size < 1G 26 | regexp=\s+(\d{9}|\d{3}M)(?=\s[A-Z][a-z]{2}\s) 27 | colours=red 28 | ======= 29 | # size: 1G <= size 30 | regexp=\s+(\d{10,}|[\d.,]+G)(?=\s[A-Z][a-z]{2}\s) 31 | colours=bold red 32 | ======= 33 | # device major minor numbers 34 | regexp=\s(\d+),\s+(\d+)\s 35 | colours=default,bright_yellow ,yellow 36 | ======= 37 | # Date-Time => G1=Month G2=Day G3=Hour G4=Minutes G5=Year 38 | regexp=([A-Z][a-z]{2})\s([ 1-3]\d)\s(?:([0-2]?\d):([0-5]\d)(?=[\s,]|$)|\s*(\d{4})) 39 | colours=unchanged,cyan,cyan,cyan,cyan,bold magenta 40 | ======= 41 | # root 42 | regexp=\s(root|wheel)(?=\s|$) 43 | colours=unchanged,bold white on_red 44 | ======= 45 | # SELinux 46 | regexp=(\w+_u):(\w+_r):(\w+_t):(\w\d) 47 | colours=default,green,yellow,cyan,magenta 48 | - 49 | # -rwxrwxrwx ============================ 50 | # File Type 51 | regexp=(-|([bcCdDlMnpPs?]))(?=[-r][-w][-xsStT][-r][-w][-xsStT][-r][-w][-xsStT]) 52 | colours=unchanged,unchanged,bold white 53 | - 54 | # owner rwx 55 | regexp=(?<=[-bcCdDlMnpPs?])(-|(r))(-|(w))(-|([xsStT]))(?=[-r][-w][-xsStT][-r][-w][-xsStT]) 56 | colours=unchanged,unchanged,bright_green,unchanged,bright_green,unchanged,bright_green 57 | - 58 | # group rwx 59 | regexp=(?<=[-bcCdDlMnpPs?][-r][-w][-xsStT])(-|(r))(-|(w))(-|([xsStT]))(?=[-r][-w][-xsStT]) 60 | colours=unchanged,unchanged,yellow,unchanged,yellow,unchanged,yellow 61 | - 62 | # other rwx 63 | regexp=(?<=[-bcCdDlMnpPs?][-r][-w][-xsStT][-r][-w][-xsStT])(-|(r))(-|(w))(-|([xsStT])) 64 | colours=unchanged,unchanged,bright_red,unchanged,bright_red,unchanged,bright_red 65 | - 66 | # sStT all 67 | regexp=(?<=[-bcCdDlMnpPs?])[-r][-w]([sStT])[-r][-w]([sStT])[-r][-w]([sStT]) 68 | colours=unchanged,bold green,bold yellow, bold red 69 | - 70 | # ACL 71 | regexp=^\S{10}(\+) 72 | colours=unchanged,on_cyan bold white 73 | -------------------------------------------------------------------------------- /colourfiles/conf.lsattr: -------------------------------------------------------------------------------- 1 | # Normal 2 | regexp=[aAcCdDeijsStTu] 3 | colours=cyan 4 | - 5 | # User Namespace 6 | regexp=[iadA] 7 | colours=bright_green 8 | - 9 | # Read Only 10 | regexp=[EhINXZ] 11 | colours=bold red 12 | - 13 | # Separators 14 | regexp=[\-] 15 | colours=dark 16 | - 17 | # Error 18 | regexp=(lsattr:) \w.* 19 | colours=default, bold red 20 | - 21 | # Filename 22 | regexp=(\/[-\w\d. ]+)+$ 23 | colours=yellow,bold 24 | -------------------------------------------------------------------------------- /colourfiles/conf.lsblk: -------------------------------------------------------------------------------- 1 | # Main HD 2 | regexp=^[a-z]+\d?\s 3 | colours=bold white 4 | ====== 5 | # Partition 6 | regexp=([├└─│]+|[\|\`\-]+)(\S+) 7 | colours=bright_green 8 | ====== 9 | # Partition - LVM 10 | regexp=\s+([├└─│]+|[\|\`\-]+)(\S+) 11 | colours=default,default,bright_cyan 12 | ====== 13 | # Type crypt 14 | regexp=(?<=\s)crypt\b 15 | colours=on_magenta white 16 | ====== 17 | # Type disk 18 | regexp=(?<=\s)disk\b 19 | colours=magenta 20 | ====== 21 | # Type lvm 22 | regexp=(?<=\s)lvm\b 23 | colours=bold cyan 24 | ====== 25 | # Type part 26 | regexp=(?<=\s)part\b 27 | colours=cyan 28 | ====== 29 | # Type loop 30 | regexp=(?<=\s)loop\b 31 | colours=bright_red 32 | ====== 33 | # Size 'K' 34 | regexp=\s\d*[.,]?\dKi?\s 35 | colours=green 36 | ====== 37 | # Size 'M' 38 | regexp=\s\d*[.,]?\dMi?\s 39 | colours=yellow 40 | ====== 41 | # Size 'G' 42 | regexp=\s\d*[.,]?\dGi?\s 43 | colours=red 44 | ====== 45 | # Size 'T' 46 | regexp=\s\d*[.,]?\dTi?\s 47 | colours=bold red 48 | ====== 49 | # Mount Path 50 | regexp=(?<=\s)(\/[^\/ ]*)+$ 51 | colours=yellow,bold yellow 52 | ====== 53 | # Mount [SWAP] 54 | regexp=\s\[(SWAP)\] 55 | colours=default,bright_magenta 56 | ====== 57 | # UUID 58 | regexp=(?<=\s)\b([0-9a-fA-F-]{4,}|[\w-]{38})\b 59 | colours=default,dark cyan 60 | -------------------------------------------------------------------------------- /colourfiles/conf.lsmod: -------------------------------------------------------------------------------- 1 | # Main 2 | regexp=(\S+)\s+(\d+)\s+(\d+) 3 | colours=default,bright_green,cyan,yellow 4 | -------------------------------------------------------------------------------- /colourfiles/conf.lsof: -------------------------------------------------------------------------------- 1 | # device major minor numbers 2 | regexp=\s(\d+),(\d+)\s 3 | colours=unchanged,bright_yellow ,yellow 4 | - 5 | # root 6 | regexp=\broot\b 7 | colours=bold white on_red 8 | - 9 | # PID 10 | regexp=^(\S+)\s+(\d+)\s 11 | colours=unchanged,bold cyan,cyan 12 | - 13 | # PATH 14 | regexp=\s\/.*\/(\S+)($| \(.*\)) 15 | colours=green,bright_green,red 16 | -------------------------------------------------------------------------------- /colourfiles/conf.lspci: -------------------------------------------------------------------------------- 1 | # Address 2 | regexp=^(..):(..).(.) 3 | colours=default,bright_green,bright_yellow,red 4 | - 5 | # Ethernet 6 | regexp=(Ethernet|Network) controller: 7 | colours=cyan 8 | - 9 | # Wireless 10 | regexp=Wireless 11 | colours=bright_cyan 12 | - 13 | # SATA 14 | regexp=SATA controller: 15 | colours=green 16 | - 17 | # Audio 18 | regexp=Audio device: 19 | colours=blue 20 | - 21 | # Video 22 | regexp=VGA compatible controller: 23 | colours=magenta 24 | - 25 | # Bridges 26 | regexp=(PCI|ISA|Host) bridge: 27 | colours=red 28 | - 29 | # any unspecified controller 30 | regexp=([A-Z].+?) controller: 31 | colours=blue 32 | - 33 | # For lspci -k 34 | regexp=Kernel (?:modules|driver in use): (.+) 35 | colours=default,bright_red 36 | - 37 | -------------------------------------------------------------------------------- /colourfiles/conf.mount: -------------------------------------------------------------------------------- 1 | # Intended for colouring 'mount' output 2 | # written by Emanuele Aina 3 | 4 | regexp=^(.*) on (.*) type (.*) \((.*)\) 5 | colours=default,green,yellow,blue,magenta 6 | - 7 | # Devices 8 | regexp=^(\/[^\/ ]+)+ 9 | colours=bold green, on_green black 10 | - 11 | # Mount Path 12 | regexp=(?<=on )(\/[^\/ ]+)+ 13 | colours=unchanged,underline yellow 14 | - 15 | # RW 16 | regexp=(?<=\()rw 17 | colours=bold red 18 | - 19 | # RO 20 | regexp=(?<=\()ro 21 | colours=bold green 22 | - 23 | # Like comment, leave at end always 24 | regexp=^(cgroup|tmpfs).* 25 | colours=bright_black 26 | -------------------------------------------------------------------------------- /colourfiles/conf.mtr: -------------------------------------------------------------------------------- 1 | #ip address 2 | regexp=\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3} 3 | colours=green 4 | ======= 5 | # 0 Full Line | 1 Loss | 2 Snt | 3 Last | 4 Avg | 5 Best | 6 Worst | 7 stDev 6 | regexp=(\d+\.\d%)\s+(\d+)\s+(\d+\.\d)\s+(\d+\.\d)\s+(\d+\.\d)\s+(\d+\.\d)\s+(\d+\.\d)$ 7 | colours=unchanged,yellow,unchanged,unchanged,blue,green,red,unchanged 8 | ======= 9 | # unknow host 10 | regexp=\?\?\? 11 | colours=red 12 | ======= 13 | # Packets/Pings 14 | regexp=(Packets|Pings) 15 | colours=bold green 16 | -------------------------------------------------------------------------------- /colourfiles/conf.mvn: -------------------------------------------------------------------------------- 1 | # mvn grc colorizer configuration 2 | # [INFO] 3 | regexp=^\[INFO\] 4 | colours=bold 5 | count=more 6 | ============== 7 | # [WARNING] 8 | regexp=^\[WARNING\] 9 | colours=bold yellow 10 | count=more 11 | ============== 12 | # [ERROR] 13 | regexp=^\[ERROR\] 14 | colours=bold red 15 | count=more 16 | ============== 17 | # BUILD FAILURE 18 | regexp=BUILD FAILURE 19 | colours=bold red 20 | count=more 21 | ============== 22 | # [debug] 23 | regexp=^\[debug\] 24 | colours=magenta 25 | count=more 26 | ============== 27 | # lines [INFO] ---- 28 | regexp=\s[-]{6,} 29 | colours=red 30 | count=more 31 | ============== 32 | # lines ^---- 33 | regexp=^[-]{6,} 34 | colours=yellow 35 | count=more 36 | ============== 37 | # lines T E S T S 38 | regexp=^ T E S T S 39 | colours=yellow 40 | count=more 41 | ============== 42 | # lines ^Tests run: 43 | regexp=^Tests run: ([\d]+) 44 | colours=yellow,green 45 | count=more 46 | ============== 47 | # lines ^Tests run: Failures/Errors/Skipped 48 | regexp=(Failures|Errors|Skipped):\s([\d]+) 49 | colours=none,yellow,bold red 50 | count=more 51 | ============== 52 | # lines ^Tests run: Failures/Errors/Skipped 53 | regexp=(Failures|Errors|Skipped):\s(0)\D? 54 | colours=none,yellow,green 55 | count=more 56 | ============== 57 | # summary 58 | regexp=\s(Total time: )(.*)$ 59 | colours=none,none,bold yellow 60 | count=more 61 | ============== 62 | # summary 63 | regexp=\s(Finished at: )(.*)$ 64 | colours=none,none,bold yellow 65 | count=more 66 | ============== 67 | # BUILD SUCCESSFUL 68 | regexp=\s(BUILD SUCCESSFUL) 69 | colours=none,green bold 70 | count=more 71 | ============== 72 | # Building projectName 73 | regexp=^(\[INFO\])( Building )(.*)$ 74 | colours=none,bold,none,white bold 75 | count=more 76 | ============== 77 | # reactor summary 78 | regexp=([.]{3,} )(SUCCESS)( \[)([^\]]*)(]) 79 | colours=none,none,green,none,yellow,none 80 | count=more 81 | ============== 82 | # reactor summary 83 | regexp=([.]{3,} )(FAILURE)( \[)([^\]]*)(]) 84 | colours=none,none,red,none,red,none 85 | count=more 86 | ============== 87 | # reactor summary 88 | regexp=([.]{3,} )(SKIPPED) 89 | colours=none,none,yellow bold,none 90 | count=more 91 | 92 | 93 | -------------------------------------------------------------------------------- /colourfiles/conf.netstat: -------------------------------------------------------------------------------- 1 | # ip number 2 | regexp=\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3} 3 | colours=magenta 4 | ======= 5 | # hostname:service 6 | regexp=([\w\.\-]+):([\w\-]+)\b 7 | colours=yellow, bold green, bold yellow 8 | ======= 9 | # hostname:port 10 | regexp=([\w\.\-]+):(\d+)\b 11 | colours=yellow, bold green, bold red 12 | ======= 13 | # *:service 14 | regexp=(\*):([\w\-]+)\b 15 | colours=yellow, blue, bold yellow 16 | ======= 17 | # ipx hostname 18 | regexp=^IPX.*[\dABCDEF]+:[\dABCDEF]+ 19 | colours=green 20 | ======= 21 | # protocols 22 | regexp=(^tcp6?|^udp6?|^unix|^IPX|STREAM|DGRAM) 23 | colours=bold blue 24 | ======= 25 | # status 26 | regexp=FIN_WAIT.* 27 | colours=red 28 | ======= 29 | # status 30 | regexp=SYN.*? 31 | colours=bold red 32 | ======= 33 | # status 34 | regexp=LISTEN(ING)? 35 | colours=bold blue 36 | ======= 37 | # status 38 | regexp=TIME_WAIT 39 | colours=bold red 40 | ======= 41 | # status 42 | regexp=CLOS(E(_WAIT)?|ING) 43 | colours=red 44 | skip=yes 45 | ======= 46 | # status 47 | regexp=LAST_ACK 48 | colours=red 49 | ======= 50 | # status 51 | regexp=ESTAB.*?\b|CONNECTED 52 | colours=bold yellow 53 | ======= 54 | # status 55 | regexp=FREE 56 | colours=bold green 57 | ======= 58 | # status 59 | regexp=DISCONNECTING 60 | colours=red 61 | ======= 62 | # status 63 | regexp=CONNECTING 64 | colours=green 65 | ======= 66 | # status 67 | regexp=UNKNOWN 68 | colours=blink bold red 69 | ======= 70 | # status 71 | regexp=\[.*\] 72 | colours=green 73 | ======= 74 | # path 75 | regexp=(\@)[\dabcdef]+ 76 | colours=green, bold green 77 | -------------------------------------------------------------------------------- /colourfiles/conf.nmap: -------------------------------------------------------------------------------- 1 | # Scan Title 2 | regexp=Nmap scan report for (\S+)\s\(([^\)]+)\) 3 | colours=default,bold green, bold magenta 4 | - 5 | # up 6 | regexp=Host is (up) 7 | colours=default, bold green 8 | - 9 | # Failed to resolve 10 | regexp=Failed\sto\sresolve\s\"(\S+)\" 11 | colours=red,bold red 12 | - 13 | # Closed ports 14 | regexp=Not shown: (\d+)\s(closed|filtered)\sports 15 | colours=default,bright_red,red 16 | - 17 | # Titles 18 | regexp=^PORT.*$|^HOP.* 19 | colours=bold 20 | - 21 | # Ports 22 | regexp=^(\d+)\/(\w+)\s+(\w+)\s+(\S+) 23 | colours=default,bold green,magenta,cyan,bold yellow 24 | - 25 | # Ports Details 26 | regexp=^\|_?(.*) 27 | colours=bold green,default 28 | - 29 | # Trace 30 | regexp=^\d+\s+(\d+\.\d+\sms)[^0-9]*(\d+\.\d+\.\d+\.\d+) 31 | colours=default,green,magenta 32 | - 33 | # Network Distance: 34 | regexp=Network Distance:\s(\d+) 35 | colours=default,bold green 36 | -------------------------------------------------------------------------------- /colourfiles/conf.ntpdate: -------------------------------------------------------------------------------- 1 | # time offset 2 | regexp=offset\s([0-9\.,\-]+\ssec) 3 | colours=unchanged,bold green 4 | ====== 5 | # server ip 6 | regexp=server\s([0-9a-fA-F\.:]+) 7 | colours=unchanged,yellow 8 | 9 | -------------------------------------------------------------------------------- /colourfiles/conf.php: -------------------------------------------------------------------------------- 1 | # this configuration file is suitable for displaying php error log files 2 | regexp=\] PHP [^\s]+ error: 3 | colours=on_red 4 | count=once 5 | ====== 6 | regexp=\] PHP Notice: 7 | colours=on_yellow black 8 | count=once 9 | ====== 10 | regexp=\] PHP Warning: 11 | colours=on_cyan 12 | count=once 13 | ====== 14 | regexp=(PHP )?Stack trace: 15 | colours=on_green 16 | count=once 17 | ====== 18 | regexp=] PHP [ \d]{2}\d\. 19 | colours=on_green 20 | count=once 21 | ====== 22 | # display this line in yellow and stop further processing 23 | regexp=.*last message repeated \d+ times$ 24 | colours=yellow 25 | count=stop 26 | ====== 27 | # this is date 28 | regexp=^... (\d| )\d \d\d:\d\d:\d\d(\s[\w\d]+?\s) 29 | colours=green, green, red 30 | count=once 31 | ====== 32 | # everything in parentheses 33 | regexp=\(.+?\) 34 | colours=green 35 | count=more 36 | ====== 37 | # everything in `' 38 | regexp=\`.+?\' 39 | colours=bold yellow 40 | count=more 41 | ====== 42 | # this is probably a pathname 43 | regexp=/[\w/\.]+ 44 | colours=bold green 45 | count=more 46 | ====== 47 | # name of process and pid 48 | regexp=([\w/\.\-]+)(\[\d+?\]) 49 | colours=bold blue, bold red 50 | count=more 51 | ====== 52 | # ip number 53 | regexp=\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3} 54 | colours=bold magenta 55 | count=more 56 | ====== 57 | # connect requires special attention 58 | regexp=connect 59 | colours=on_red 60 | count=more 61 | ====== 62 | regexp=not found or unable to stat 63 | colours=black 64 | count=block 65 | ====== 66 | regexp=File does not exist 67 | colours=italic black 68 | count=block 69 | ====== 70 | regexp=^\[ 71 | colours=default 72 | count=unblock 73 | 74 | -------------------------------------------------------------------------------- /colourfiles/conf.ping: -------------------------------------------------------------------------------- 1 | # IP 2 | regexp=\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3} 3 | colours=bright_blue 4 | ======= 5 | # ipv6 number 6 | regexp=(([0-9a-fA-F]{1,4})?\:\:?[0-9a-fA-F]{1,4})+ 7 | colours=magenta 8 | ======= 9 | # icmp_seq=## 10 | regexp=icmp_seq=(\d+) 11 | colours=default,yellow 12 | ======= 13 | # ttl=# 14 | regexp=ttl=(\d+) 15 | colours=default,magenta 16 | ======= 17 | # name 18 | regexp=(?:[fF]rom|PING)\s(\S+)\s 19 | colours=default,blue 20 | ======= 21 | # time 22 | regexp=([0-9\.]+)\s?ms 23 | colours=green,bold green 24 | ======= 25 | # DUP 26 | regexp=DUP\! 27 | colours=red 28 | ======= 29 | # OK 30 | regexp= 0(\.0)?% packet loss 31 | colours=green 32 | ======= 33 | # Errors 34 | regexp=(Destination Host Unreachable|100(\.0)?% packet loss) 35 | colours=red 36 | ======= 37 | # unknown host 38 | regexp=.+unknown\shost\s(.+) 39 | colours=red,bold red 40 | - 41 | # statistics header 42 | regexp=--- (\S+) ping statistics --- 43 | colours=bold, bold blue 44 | - 45 | # last line min/avg/max/mdev 46 | regexp=rtt (min)/(avg)/(max)/(mdev) 47 | colours=default,bright_yellow,bright_blue,bright_red,bright_magenta 48 | - 49 | # last line values 50 | regexp=\=\s([0-9\.]+)\/([0-9\.]+)\/([0-9\.]+)\/([0-9\.]+) 51 | colours=default,bright_yellow,bright_blue,bright_red,bright_magenta 52 | - 53 | # these are good for nping 54 | regexp=SENT|RCVD 55 | colours=red 56 | - 57 | # nping 58 | regexp=unreachable 59 | colours=red 60 | 61 | -------------------------------------------------------------------------------- /colourfiles/conf.ping2: -------------------------------------------------------------------------------- 1 | # ip number 2 | regexp=\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3} 3 | colours=magenta 4 | ======= 5 | # ipv6 number 6 | regexp=(([0-9a-fA-F]{1,4})?\:\:?[0-9a-fA-F]{1,4})+ 7 | colours=magenta 8 | ======= 9 | # time 10 | regexp=\d+\.\d+\sms 11 | colours=green 12 | ======= 13 | # time 14 | regexp=\d+\sms 15 | colours=green 16 | ====== 17 | # time 18 | regexp=time= 19 | colours=yellow 20 | ======= 21 | # DUP 22 | regexp=DUP\! 23 | colours=red 24 | ======= 25 | # (,) 26 | regexp=\(|\) 27 | colours=yellow 28 | ======= 29 | # unknown host 30 | regexp=.+unknown\shost\s(.+) 31 | colours=red,bold red 32 | ======= 33 | regexp=.*icmp_seq=(\d+) timeout 34 | replace=TIMEOUT \1 35 | colours=red 36 | 37 | 38 | 39 | -------------------------------------------------------------------------------- /colourfiles/conf.proftpd: -------------------------------------------------------------------------------- 1 | # this configuration file is suitable for displaying proftpd log files 2 | # submitted by Pavol Domin 3 | 4 | # everything in brakets 5 | regexp=\[.+?\] 6 | colours=cyan 7 | count=more 8 | ====== 9 | # everything in "" 10 | regexp=\".+?\" 11 | colours=green 12 | count=more 13 | ====== 14 | # ip number 15 | regexp=\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3} 16 | colours=bold magenta 17 | count=more 18 | ====== 19 | # STOR 20 | regexp=STOR 21 | colours=bold red on_white 22 | count=more 23 | ====== 24 | # RETR 25 | regexp=RETR 26 | colours=black on_white 27 | count=more 28 | == 29 | # first tree fields separated by space 30 | regexp=^([\w\.]+?\s)([\w\.]+?\s)([\w\.]+?\s) 31 | colours=bold blue, bold yellow, bold magenta 32 | -------------------------------------------------------------------------------- /colourfiles/conf.ps: -------------------------------------------------------------------------------- 1 | # /full/path 2 | regexp=(\s|^)/[-\w\d.]+/[-\w\d./]+ 3 | colours=bold white 4 | ======= 5 | # CAPS LINE 6 | regexp=^[A-Z\s%]*([A-Z]{3})[A-Z\s%]*$ 7 | colours=underline 8 | ======= 9 | # Capd Line 10 | regexp=^([A-Z][-a-z0-9]+(\s+|$)){3,}$ 11 | colours=underline 12 | ======= 13 | # VMSTAT 14 | regexp=(\s|^)\d+([.,]\d+)?(?=[\s,]|$) 15 | colours=bright_green 16 | ======= 17 | # PID 18 | regexp=^[a-zA-Z]+\w+\s+(\d+)|^\d\s+\w\s+(?:\w+\s+)?(\d+)|^\s*(\d+) 19 | colours=unchanged,bold magenta,bold magenta,bold magenta 20 | ======= 21 | # n.n.n 22 | regexp=(\s|^)\d+\.\d+\.\d+(?=[\s,]|$) 23 | colours=bold cyan 24 | ======= 25 | # text: 26 | regexp=^([-a-z0-9]+):\s 27 | colours=unchanged,yellow 28 | ======= 29 | # -options 30 | regexp=(?<=\s)-[\w\d]+(?=\s|$) 31 | colours=yellow 32 | ======= 33 | # --long-option= 34 | # legacy: regexp=(?<=\s)--[-\w\d]+[\w\d](?==|\s|$)(=?) 35 | regexp=(?<=\s)--[-\w\d]+[\w\d](?==|\s|$)(=|\s)?(?!--)([^\s]*) 36 | colours=cyan,white,underline cyan 37 | ======= 38 | # [text] 39 | regexp=\[[-\w\d:/]+\] 40 | colours=cyan 41 | ======= 42 | # root 43 | regexp=root|wheel(?=\s|$) 44 | colours=bold red 45 | ======= 46 | # pts 47 | regexp=(\s|^)pts/\d+(?=[^\w\d]|$) 48 | colours=bright_yellow 49 | ======= 50 | # tty 51 | regexp=(\s|^)tty\d+(?=[^\w\d]|$) 52 | colours=bright_cyan 53 | ======= 54 | # Negative NICE (works only in -l) 55 | regexp=^\d\s+\w\s+\w+\s+\d+\s+\d+\s+\d\s+\d+\s+(-\d+) 56 | colours=unchanged,on_red bold white 57 | ======= 58 | # Neutral NICE (works only in -l) 59 | regexp=^\d\s+\w\s+\w+\s+\d+\s+\d+\s+\d\s+\d+\s+(\d+) 60 | colours=unchanged,cyan 61 | ======= 62 | # Positive NICE (works only in -l) 63 | regexp=^\d\s+\w\s+\w+\s+\d+\s+\d+\s+\d\s+\d+\s+(1\d) 64 | colours=unchanged,on_cyan bold white 65 | ======= 66 | # Process ZOMBIE 67 | regexp=^\d\s+([zZ])\s 68 | colours=unchanged,on_red bold white 69 | ======= 70 | # Process RS 71 | regexp=^\d\s+([sSrR])\s 72 | colours=unchanged,on_magenta black 73 | -------------------------------------------------------------------------------- /colourfiles/conf.pv: -------------------------------------------------------------------------------- 1 | # size 2 | regexp=(\s|^)\d+([.,]\d+)?\s?([kKMG][bB]|[bB]|[kKMG])(?=[\s,]|$) 3 | colours=yellow 4 | ======= 5 | # 6 | regexp=<=> 7 | colours=yellow 8 | 9 | -------------------------------------------------------------------------------- /colourfiles/conf.semanageboolean: -------------------------------------------------------------------------------- 1 | # Name 2 | regexp=^\S+ 3 | colours=white 4 | - 5 | # State 6 | regexp=\s\((off) 7 | colours=default,bright_red 8 | - 9 | # State 10 | regexp=\s\((on) 11 | colours=default,bright_green 12 | - 13 | # State 14 | regexp=\,\s+(off)\) 15 | colours=default,dark red 16 | - 17 | # State 18 | regexp=\,\s+(on)\) 19 | colours=default,dark green 20 | -------------------------------------------------------------------------------- /colourfiles/conf.semanagefcontext: -------------------------------------------------------------------------------- 1 | # SELinux 2 | regexp=(\w+_u):(\w+_r):(\w+_t):(\w\d) 3 | colours=default,green,yellow,cyan,magenta 4 | - 5 | # Path 6 | regexp=\/\S+(\/\S+)\( 7 | colours=green,bright_green 8 | - 9 | # Almost universal regex 10 | regexp=\.\*|\[\^\/\]\*|\(\/\.\*\)\?|\?|\\\. 11 | colours=blue 12 | -------------------------------------------------------------------------------- /colourfiles/conf.semanageuser: -------------------------------------------------------------------------------- 1 | # r 2 | regexp=\S+_r 3 | colours=yellow 4 | - 5 | # u 6 | regexp=\S+_u 7 | colours=green 8 | - 9 | # t 10 | regexp=\S+_t 11 | colours=cyan 12 | - 13 | # s 14 | regexp=s\d+ 15 | colours=magenta 16 | - 17 | # tcp for ports 18 | regexp=tcp 19 | colours=blue 20 | - 21 | # udp for ports 22 | regexp=udp 23 | colours=yellow 24 | -------------------------------------------------------------------------------- /colourfiles/conf.sensors: -------------------------------------------------------------------------------- 1 | # Sensor name 2 | regexp=([a-z\-0-9]+) 3 | colours=underline yellow 4 | ====== 5 | # Data names 6 | regexp=(.+:)\s+(.+) 7 | colours=unchanged, bright_cyan, default 8 | ====== 9 | # Extra info 10 | regexp=.+\s+(\(.+\)) 11 | colours=unchanged, bright_black 12 | ====== 13 | # Adapter name 14 | regexp=Adapter:(\s.*) 15 | colours=unchanged, yellow 16 | ====== 17 | # Low temperature (below 60) 18 | regexp=.+:\s+(\+[2345][0-9]\.[0-9]°C) 19 | colours=unchanged, green 20 | ====== 21 | # High temperature (above 60) 22 | regexp=.+:\s+(\+[67][0-9]\.[0-9]°C) 23 | colours=unchanged, bright_yellow 24 | ====== 25 | # Very high temperature (above 80) 26 | regexp=.+:\s+(\+[89][0-9]\.[0-9]°C) 27 | colours=unchanged, bright_red 28 | ====== 29 | -------------------------------------------------------------------------------- /colourfiles/conf.showmount: -------------------------------------------------------------------------------- 1 | # Path 2 | regexp=^(\/\S+) 3 | colours=green 4 | - 5 | # Path Last part 6 | regexp=\/(\w+)\s 7 | colours=unchanged,bright_green 8 | - 9 | # IP 10 | regexp=(\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}(\/\d+)?) 11 | colours=default,yellow,magenta 12 | - 13 | # ALL 14 | regexp=\* 15 | colours=bold red 16 | - 17 | # Options 18 | regexp=\(([\w,]+)\) 19 | colours=default,cyan 20 | - 21 | # Server 22 | regexp=for\s([^:]+):$ 23 | colours=default,bold yellow 24 | -------------------------------------------------------------------------------- /colourfiles/conf.sockstat: -------------------------------------------------------------------------------- 1 | ======= 2 | # CAPS LINE 3 | regexp=^[A-Z\s%]*([A-Z]{3})[A-Z\s%]*$ 4 | colours=underline 5 | ======= 6 | # root 7 | regexp=^root(?=\s|$) 8 | colours=bold red 9 | ======= 10 | # non-root users 11 | regexp=^(?:(?!root|USER))([^\s]+) 12 | colours=bold yellow,unchanged 13 | ======= 14 | # CMD 15 | regexp=^[a-zA-Z]+\w+\s+(\w+)\s+\d+ 16 | colours=unchanged,bold cyan 17 | ======= 18 | # FD 19 | regexp=^[a-zA-Z]+\w+\s+\w+\s+\d+\s+(\d+) 20 | colours=unchanged,yellow 21 | ======= 22 | # PID 23 | regexp=^[a-zA-Z]+\w+\s+[a-zA-Z]+\w+\s+(\d+) 24 | colours=unchanged,bold magenta 25 | ======= 26 | # PROTOCOLS 27 | regexp=(tcp4|udp4|tcp6|udp6|stream|dgram) 28 | colours=bold blue 29 | ======= 30 | # hostname:service 31 | regexp=([\w\.\-]+):([\w\-]+)\b 32 | colours=yellow, bold green, bold yellow 33 | ======= 34 | # hostname:port 35 | regexp=([\w\.\-]+):(\d+)\b 36 | colours=yellow, bold green, bold red 37 | ======= 38 | # *:service 39 | regexp=(\*):([\w\-]+)\b 40 | colours=yellow, yellow, bold red 41 | ======= 42 | # PATH 43 | regexp=\s\/.*\/(\S+)($| \(.*\)) 44 | colours=green,bright_green,red 45 | ======= 46 | # status 47 | regexp=FIN_WAIT.* 48 | colours=red 49 | ======= 50 | # status 51 | regexp=SYN.*? 52 | colours=bold red 53 | ======= 54 | # status 55 | regexp=LISTEN(ING)? 56 | colours=bold blue 57 | ======= 58 | # status 59 | regexp=TIME_WAIT 60 | colours=bold red 61 | ======= 62 | # status 63 | regexp=CLOS(E(_WAIT)?|ING) 64 | colours=red 65 | skip=yes 66 | ======= 67 | # status 68 | regexp=LAST_ACK 69 | colours=red 70 | ======= 71 | # status 72 | regexp=ESTAB.*?\b|CONNECTED 73 | colours=bold yellow 74 | ======= 75 | # status 76 | regexp=FREE 77 | colours=bold green 78 | ======= 79 | # status 80 | regexp=DISCONNECTING 81 | colours=red 82 | ======= 83 | # status 84 | regexp=CONNECTING 85 | colours=green 86 | ======= 87 | # status 88 | regexp=CONNECTING 89 | colours=green 90 | ======= 91 | # status 92 | regexp=UNKNOWN 93 | colours=blink bold red 94 | -------------------------------------------------------------------------------- /colourfiles/conf.sql: -------------------------------------------------------------------------------- 1 | # this configuration file is for displaying sql scripts very nice to use with sqlformat aka sqlparser 2 | regexp=\w 3 | colours="\033[38;5;140m" 4 | count=more 5 | ====== 6 | regexp=\b(MIN|MAX|CASE|IF|ELSE|SUBDATE|NOW|ABORT|ABS|ABSOLUTE|ACCESS|ADA|ADD|ADMIN|AFTER|AGGREGATE|ALIAS|ALL|ALLOCATE|ANALYSE|ANALYZE|ANY|ARE|ASC|ASENSITIVE|ASSERTION|ASSIGNMENT|ASYMMETRIC|AT|ATOMIC|AUTHORIZATION|AVG|BACKWARD|BEFORE|BEGIN|BETWEEN|BITVAR|BIT_LENGTH|BOTH|BREADTH|CACHE|CALL|CALLED|CARDINALITY|CASCADE|CASCADED|CAST|CATALOG|CATALOG_NAME|CHAIN|CHARACTERISTICS|CHARACTER_LENGTH|CHARACTER_SET_CATALOG|CHARACTER_SET_NAME|CHARACTER_SET_SCHEMA|CHAR_LENGTH|CHECK|CHECKED|CHECKPOINT|CLASS|CLASS_ORIGIN|CLOB|CLOSE|CLUSTER|COALESCE|COBOL|COLLATE|COLLATION|COLLATION_CATALOG|COLLATION_NAME|COLLATION_SCHEMA|COLLECT|COLUMN|COLUMN_NAME|COMMAND_FUNCTION|COMMAND_FUNCTION_CODE|COMMENT|COMMIT|COMMITTED|COMPLETION|CONDITION_NUMBER|CONNECT|CONNECTION|CONNECTION_NAME|CONSTRAINT|CONSTRAINTS|CONSTRAINT_CATALOG|CONSTRAINT_NAME|CONSTRAINT_SCHEMA|CONSTRUCTOR|CONTAINS|CONTINUE|CONVERSION|CONVERT|COPY|CORRESPONTING|COUNT|CREATEDB|CREATEUSER|CROSS|CUBE|CURRENT|CURRENT_DATE|CURRENT_PATH|CURRENT_ROLE|CURRENT_TIME|CURRENT_TIMESTAMP|CURRENT_USER|CURSOR|CURSOR_NAME|CYCLE|DATA|DATABASE|DATETIME_INTERVAL_CODE|DATETIME_INTERVAL_PRECISION|DAY|DEALLOCATE|DECLARE|DEFAULT|DEFAULTS|DEFERRABLE|DEFERRED|DEFINED|DEFINER|DELIMITER|DELIMITERS|DEREF|DESC|DESCRIBE|DESCRIPTOR|DESTROY|DESTRUCTOR|DETERMINISTIC|DIAGNOSTICS|DICTIONARY|DISCONNECT|DISPATCH|DO|DOMAIN|DYNAMIC|DYNAMIC_FUNCTION|DYNAMIC_FUNCTION_CODE|EACH|ENCODING|ENCRYPTED|END-EXEC|EQUALS|ESCAPE|EVERY|EXCEPT|EXCEPTION|EXCLUDING|EXCLUSIVE|EXEC|EXECUTE|EXISTING|EXISTS|EXTERNAL|EXTRACT|FALSE|FETCH|FINAL|FIRST|FORCE|FOREACH|FOREIGN|FORTRAN|FORWARD|FOUND|FREE|FREEZE|FULL|FUNCTION| 'G|GENERAL|GENERATED|GET|GLOBAL|GO|GOTO|GRANT|GRANTED|GROUPING|HANDLER|HAVING|HIERARCHY|HOLD|HOST|IDENTITY|IGNORE|ILIKE|IMMEDIATE|IMMUTABLE|IMPLEMENTATION|IMPLICIT|INCLUDING|INCREMENT|INDEX|INDITCATOR|INFIX|INHERITS|INITIALIZE|INITIALLY|INOUT|INPUT|INSENSITIVE|INSTANTIABLE|INSTEAD|INTERSECT|INTO|INVOKER|IS|ISNULL|ISOLATION|ITERATE|KEY|KEY_MEMBER|KEY_TYPE|LANCOMPILER|LANGUAGE|LARGE|LAST|LATERAL|LEADING|LENGTH|LESS|LEVEL|LIMIT|LISTEN|LOAD|LOCAL|LOCALTIME|LOCALTIMESTAMP|LOCATION|LOCATOR|LOCK|LOWER|MAP|MATCH|MAXVALUE|MESSAGE_LENGTH|MESSAGE_OCTET_LENGTH|MESSAGE_TEXT|METHOD|MINUTE|MINVALUE|MOD|MODE|MODIFIES|MODIFY|MONTH|MORE|MOVE|MUMPS|NAMES|NATIONAL|NATURAL|NCHAR|NCLOB|NEW|NEXT|NO|NOCREATEDB|NOCREATEUSER|NONE|NOT|NOTHING|NOTIFY|NOTNULL|NULL|NULLABLE|IFNULL|NULLIF|OBJECT|OCTET_LENGTH|OF|OFF|OFFSET|OIDS|OLD|ONLY|OPEN|OPERATION|OPERATOR|OPTION|OPTIONS|ORDINALITY|OUT|OUTPUT|OVERLAPS|OVERLAY|OVERRIDING|OWNER|PAD|PARAMETER|PARAMETERS|PARAMETER_MODE|PARAMATER_NAME|PARAMATER_ORDINAL_POSITION|PARAMETER_SPECIFIC_CATALOG|PARAMETER_SPECIFIC_NAME|PARAMATER_SPECIFIC_SCHEMA|PARTIAL|PASCAL|PENDANT|PLACING|PLI|POSITION|POSTFIX|PRECISION|PREFIX|PREORDER|PREPARE|PRESERVE|PRIMARY|PRIOR|PRIVILEGES|PROCEDURAL|PROCEDURE|PUBLIC|RAISE|READ|READS|RECHECK|RECURSIVE|REF|REFERENCES|REFERENCING|REINDEX|RELATIVE|RENAME|REPEATABLE|RESET|RESTART|RESTRICT|RESULT|RETURN|RETURNED_LENGTH|RETURNED_OCTET_LENGTH|RETURNED_SQLSTATE|RETURNS|REVOKE|RIGHT|ROLE|ROLLBACK|ROLLUP|ROUTINE|ROUTINE_CATALOG|ROUTINE_NAME|ROUTINE_SCHEMA|ROW|ROWS|ROW_COUNT|RULE|SAVE_POINT|SCALE|SCHEMA|SCHEMA_NAME|SCOPE|SCROLL|SEARCH|SECOND|SECURITY|SELF|SENSITIVE|SEQUENCE|SERIALIZABLE|SERVER_NAME|SESSION|SESSION_USER|SETOF|SETS|SHARE|SHOW|SIMILAR|SIMPLE|SIZE|SOME|SOURCE|SPACE|SPECIFIC|SPECIFICTYPE|SPECIFIC_NAME|SQL|SQLCODE|SQLERROR|SQLEXCEPTION|SQLSTATE|SQLWARNING|STABLE|START|STATE|STATEMENT|STATIC|STATISTICS|STDIN|STDOUT|STORAGE|STRICT|STRUCTURE|STYPE|SUBCLASS_ORIGIN|SUBLIST|SUBSTRING|SUM|SYMMETRIC|SYSID|SYSTEM|SYSTEM_USER|TABLE|TABLE_NAME|TEMP|TEMPLATE|TEMPORARY|TERMINATE|THAN|TIMESTAMP|TIMEZONE_HOUR|TIMEZONE_MINUTE|TO|TOAST|TRAILING|TRANSATION|TRANSACTIONS_COMMITTED|TRANSACTIONS_ROLLED_BACK|TRANSATION_ACTIVE|TRANSFORM|TRANSFORMS|TRANSLATE|TRANSLATION|TREAT|TRIGGER|TRIGGER_CATALOG|TRIGGER_NAME|TRIGGER_SCHEMA|TRIM|TRUE|TRUNCATE|TRUSTED|TYPE|UNCOMMITTED|UNDER|UNENCRYPTED|UNION|UNIQUE|UNKNOWN|UNLISTEN|UNNAMED|UNNEST|UNTIL|UPPER|USAGE|USE|USER|USER_DEFINED_TYPE_CATALOG|USER_DEFINED_TYPE_NAME|USER_DEFINED_TYPE_SCHEMA|USING|VACUUM|VALID|VALIDATOR|VALUES|VARIABLE|VERBOSE|VERSION|VIEW|VOLATILE|WHENEVER|WITH|WITHOUT|WORK|WRITE|YEAR|ZONE)\b 7 | colours="\033[38;5;11m" 8 | count=more 9 | ====== 10 | regexp=\b(ARRAY|BIGINT|BINARY|BIT|BLOB|BOOLEAN|CHAR|CHARACTER|DATE|DEC|DECIMAL|FLOAT|INT|INT8|INTEGER|LONG|NUMBER|NUMERIC|REAL|SERIAL|SERIAL8|SIGNED|SMALLINT|TEXT|TINYINT|UNSIGNED|VARCHAR|VARCHAR2|VARYING)\b 11 | colours=bright_white 12 | count=more 13 | ====== 14 | regexp=\b(HOUR|MINUTE|SECOND|INTERVAL|SELECT|INSERT|DELETE|UPDATE|REPLACE|MERGE|DROP|CREATE|ALTER|WHERE|FROM|INNER|JOIN|STRAIGHT_JOIN|AND|OR|LIKE|ON|IN|SET|BY|GROUP|ORDER|LEFT|OUTER|FULL|END|THEN|LOOP|AS|FOR|WHILE|WHEN|DISTINCT)\b 15 | colours="\033[38;5;172m" 16 | count=more 17 | ====== 18 | regexp=\, 19 | colours="\033[38;5;172m" 20 | count=more 21 | ====== 22 | regexp=\b(\d)\b 23 | colours="\033[38;5;73m" 24 | count=more 25 | ====== 26 | regexp=[=!><] 27 | colours="\033[38;5;73m" 28 | count=more 29 | ====== 30 | regexp=\/\*.*?\*\/ 31 | colours="\033[38;5;244m" 32 | count=more 33 | -------------------------------------------------------------------------------- /colourfiles/conf.ss: -------------------------------------------------------------------------------- 1 | # status 2 | regexp=\[.*\] 3 | colours=green 4 | ======= 5 | # Local Address:Port Peer Address:Port 6 | regexp=\s((?:\d+\.){3}\d+|\*|\[?[\da-fA-F\.:]+\]?|[\w\d\-\_\.]+)(%[\w\d]+)?:(\S+)\s+\s((?:\d+\.){3}\d+|\*|\[?[\da-fA-F\.:]+\]?|[\w\d\-\_\.]+):(\S+) 7 | colours=default,bright_green,blue,bright_red,cyan,magenta 8 | ======= 9 | # process name 10 | regexp=\("([^"]+)", 11 | colours=blue 12 | ======= 13 | # ipx hostname 14 | regexp=^IPX.*[\dABCDEF]+:[\dABCDEF]+ 15 | colours=green 16 | ======= 17 | # protocols 18 | regexp=(^tcp|^udp|^unix|^IPX|STREAM|DGRAM) 19 | colours=magenta 20 | ======= 21 | # protocols UDP 22 | regexp=^udp 23 | colours=yellow 24 | ======= 25 | # protocols TCP 26 | regexp=^tcp 27 | colours=blue 28 | ======= 29 | # status UNCONN 30 | regexp=UNCONN 31 | colours=dark red 32 | ======= 33 | # status 34 | regexp=FIN_WAIT.* 35 | colours=red 36 | ======= 37 | # status 38 | regexp=SYN.*? 39 | colours=bold red 40 | ======= 41 | # status 42 | regexp=LISTEN(ING)? 43 | colours=bold blue 44 | ======= 45 | # status 46 | regexp=TIME_WAIT 47 | colours=bold red 48 | ======= 49 | # status 50 | regexp=CLOS(E(_WAIT)?|ING) 51 | colours=red 52 | skip=yes 53 | ======= 54 | # status 55 | regexp=LAST_ACK 56 | colours=red 57 | ======= 58 | # status 59 | regexp=ESTAB.*?\b|CONNECTED 60 | colours=bold yellow 61 | ======= 62 | # status 63 | regexp=FREE 64 | colours=bold green 65 | ======= 66 | # status 67 | regexp=DISCONNECTING 68 | colours=red 69 | ======= 70 | # status 71 | regexp=CONNECTING 72 | colours=green 73 | ======= 74 | # status 75 | regexp=UNKNOWN 76 | colours=blink bold red 77 | ======= 78 | # path 79 | regexp=(\@)[\dabcdef]+ 80 | colours=green, bold green 81 | ======= 82 | # timer 83 | regexp=\d+sec 84 | colours=yellow 85 | ======= 86 | #Skip header 87 | regexp=(Netid|State).*$ 88 | colours=default 89 | -------------------------------------------------------------------------------- /colourfiles/conf.stat: -------------------------------------------------------------------------------- 1 | # Fields 2 | regexp=(?:IO\s)?\S+:\s 3 | colours=cyan 4 | - 5 | # Filename 6 | regexp=File: ‘(\S+)’ 7 | colours=unchanged, bold 8 | - 9 | # File Type 10 | regexp=IO\sBlock:\s\d+\s+(.*)$ 11 | colours=unchanged, bold green 12 | - 13 | # SELinux from conf.ls 14 | regexp=(\w+_u):(\w+_r):(\w+_t):(\w\d) 15 | colours=default,green,yellow,cyan,magenta 16 | - 17 | # Permission Numbers 18 | regexp=\((\d)(\d)(\d)(\d)\/ 19 | colours=default,bold white,bright_green,yellow,bright_red 20 | - 21 | # -rwxrwxrwx ============================ from conf.ls 22 | # File Type 23 | regexp=(-|([bcCdDlMnpPs?]))(?=[-r][-w][-xsStT][-r][-w][-xsStT][-r][-w][-xsStT]) 24 | colours=unchanged,unchanged,bold white 25 | - 26 | # owner rwx 27 | regexp=(?<=[-bcCdDlMnpPs?])(-|(r))(-|(w))(-|([xsStT]))(?=[-r][-w][-xsStT][-r][-w][-xsStT]) 28 | colours=unchanged,unchanged,bright_green,unchanged,bright_green,unchanged,bright_green 29 | - 30 | # group rwx 31 | regexp=(?<=[-bcCdDlMnpPs?][-r][-w][-xsStT])(-|(r))(-|(w))(-|([xsStT]))(?=[-r][-w][-xsStT]) 32 | colours=unchanged,unchanged,yellow,unchanged,yellow,unchanged,yellow 33 | - 34 | # other rwx 35 | regexp=(?<=[-bcCdDlMnpPs?][-r][-w][-xsStT][-r][-w][-xsStT])(-|(r))(-|(w))(-|([xsStT])) 36 | colours=unchanged,unchanged,bright_red,unchanged,bright_red,unchanged,bright_red 37 | - 38 | # sStT all 39 | regexp=(?<=[-bcCdDlMnpPs?])[-r][-w]([sStT])[-r][-w]([sStT])[-r][-w]([sStT]) 40 | colours=unchanged,bold green,bold yellow, bold red 41 | -------------------------------------------------------------------------------- /colourfiles/conf.sysctl: -------------------------------------------------------------------------------- 1 | # Main & Last key 2 | regexp=(\w+)\.(\S+) = ?(.+)?$ 3 | colours=default,green,cyan,yellow 4 | - 5 | # subcategories 6 | regexp=\w+\.(\S+(?=\.))\. 7 | colours=unchanged,magenta 8 | - 9 | # error 10 | regexp=sysctl: permission denied on key '([^']+)' 11 | colours=red,bold red 12 | -------------------------------------------------------------------------------- /colourfiles/conf.systemctl: -------------------------------------------------------------------------------- 1 | # Name 2 | regexp=\.service\s 3 | colours=bright_white 4 | - 5 | regexp=\.mount\s 6 | colours=magenta 7 | - 8 | regexp=\.device\s 9 | colours=blue 10 | - 11 | regexp=\.socket\s 12 | colours=cyan 13 | - 14 | regexp=\.slice\s 15 | colours=dark red 16 | - 17 | regexp=\.path\s 18 | colours=green 19 | - 20 | regexp=\.target\s 21 | colours=dark magenta 22 | - 23 | regexp=\.timer\s 24 | colours=dark cyan 25 | - 26 | regexp=\.swap\s 27 | colours=bright_magenta 28 | - 29 | regexp=\sloaded\s 30 | colours=cyan 31 | - 32 | regexp=\sactive\s 33 | colours=green 34 | - 35 | # exited 36 | regexp=exited 37 | colours=red 38 | - 39 | # running 40 | regexp=running 41 | colours=green 42 | -------------------------------------------------------------------------------- /colourfiles/conf.tcpdump: -------------------------------------------------------------------------------- 1 | # Title 2 | regexp=on ([^,]+), link-type (\S+) 3 | colours=unchanged, bold green, green 4 | - 5 | # Basic Line (-nS) 6 | regexp=^(\d+):(\d+):(\d+\.\d+) (\S+) (\S+) (>) (\S+): 7 | colours=unchanged,bold white,bright_white,dark white,cyan, bright_green, bold red, bright_blue 8 | - 9 | # IP 10 | regexp=(?:\d{1,3}\.){3}(?:\d{1,3}) 11 | colours=bold 12 | - 13 | # Summary 14 | regexp=^(\d+) packets 15 | colours=unchanged,bold green 16 | -------------------------------------------------------------------------------- /colourfiles/conf.traceroute: -------------------------------------------------------------------------------- 1 | # hostname 2 | regexp=\s\w+[\w\-\.]+\w+ 3 | colours=bold white 4 | count=once 5 | - 6 | # ip number 7 | regexp=\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3} 8 | colours=magenta 9 | - 10 | # ipv6 number 11 | regexp=(([0-9a-fA-F]{1,4})?\:\:?[0-9a-fA-F]{1,4})+ 12 | colours=magenta 13 | - 14 | # time 15 | regexp=\d+\.?\d*(?=\sms) 16 | colours=green 17 | - 18 | # ms 19 | regexp=\bms\b 20 | colours=yellow 21 | - 22 | # DUP 23 | regexp=\bDUP 24 | colours=red 25 | - 26 | # !S, !A, !H (host unreachable), etc. 27 | regexp=\s\!([HNPSFXVC]|\d+) 28 | colours=red 29 | - 30 | # ttl=...! 31 | regexp=ttl=\d+\! 32 | colours=cyan 33 | - 34 | # * 35 | regexp=\* 36 | colours=red 37 | - 38 | # parenthesis 39 | regexp=\(|\) 40 | colours=yellow 41 | -------------------------------------------------------------------------------- /colourfiles/conf.tune2fs: -------------------------------------------------------------------------------- 1 | # Values 2 | regexp=^([^:]+):(.+)$ 3 | colours=default,cyan 4 | -------------------------------------------------------------------------------- /colourfiles/conf.ulimit: -------------------------------------------------------------------------------- 1 | # ( ) 2 | regexp=\((?:([^,)]+),\s)?(-\w)\) 3 | colours=default,magenta,cyan 4 | - 5 | # unlimited 6 | regexp=\sunlimited 7 | colours=bold red 8 | - 9 | # number 10 | regexp=\s\d+ 11 | colours=yellow 12 | -------------------------------------------------------------------------------- /colourfiles/conf.uptime: -------------------------------------------------------------------------------- 1 | # Regular Up 2 | regexp=\sup(?: (\d+) days?,)? +(\d+ min|\d+:\d+)(?=,) 3 | colours=green,bold green, bold green 4 | - 5 | # users 6 | regexp=\b(\d+) users? 7 | colours=yellow,bold yellow 8 | - 9 | # load average 10 | regexp=load average: (\d+[\.,]\d+),\s(\d+[\.,]\d+),\s(\d+[\.,]\d+) 11 | colours=default,bright_cyan,cyan,dark cyan 12 | - 13 | # W Command section 14 | # Title 15 | regexp=^USER.*$ 16 | colours=bold 17 | -------------------------------------------------------------------------------- /colourfiles/conf.vmstat: -------------------------------------------------------------------------------- 1 | # Title 2 | regexp=(procs)\s(-+memory-+)\s(-+swap-+)\s(-+io-+)\s(-+system-+)\s(-+cpu-+) 3 | colours=default,bold,bold cyan,bold magenta,bold blue, bold green, bold red 4 | - 5 | # rows 6 | regexp=^(\s*\w+\s+\w+)\s+(\w+\s+\w+\s+\w+\s+\w+)\s+(\w+\s+\w+)\s+(\w+\s+\w+)\s+(\w+\s+\w+)\s+(\w+\s+\w+\s+\w+\s+\w+\s+\w+) 7 | colours=default,default,bright_cyan,bright_magenta,bright_blue,bright_green,bright_red 8 | - 9 | # ============================ DISK MODE ================================= 10 | # Title disk mode 11 | regexp=^(disk-)\s(-+reads-+)\s(-+writes-+)\s(-+IO-+) 12 | colours=default,bold,bold green,bold magenta,bold blue 13 | - 14 | # Title disk mode 15 | regexp=(\s+)(total\s+merged\s+sectors\s+ms)\s+(total\s+merged\s+sectors\s+ms)\s+(cur\s+sec) 16 | colours=default,bold,bold green,bold magenta,bold blue 17 | - 18 | # rows disk mode 19 | regexp=^(\S+)\s+(\d+\s+\d+\s+\d+\s+\d+)\s+(\d+\s+\d+\s+\d+\s+\d+)\s+(\d+\s+\d+) 20 | colours=default,bright_white,bright_green,bright_magenta,bright_blue 21 | -------------------------------------------------------------------------------- /colourfiles/conf.wdiff: -------------------------------------------------------------------------------- 1 | # new words 2 | regexp=\{\+.+\+\} 3 | colours=bold green 4 | count=more 5 | ======= 6 | # deleted words 7 | regexp=\[\-.+\-\] 8 | colours=bold green 9 | count=more 10 | -------------------------------------------------------------------------------- /colourfiles/conf.whois: -------------------------------------------------------------------------------- 1 | # field 2 | regexp=^([\w\s])*: 3 | colours=bold white 4 | ======= 5 | # data 6 | regexp=:\s[\w\s\W\S]*$ 7 | colour=blue 8 | ======= 9 | # comments 10 | regexp=^([;%])([\s\w\S\W])*$ 11 | colours=yellow 12 | ======= 13 | # comments 14 | regexp=(^(---)|(>>>))[\s\w\S\W]*$ 15 | colours=yellow 16 | ======= 17 | # domain 18 | regexp=(([\w\d]([\w\d-])+\.){1,})([\w\d-]{2,}) 19 | colours=green 20 | ======= 21 | # url 22 | regexp=http[s]?://(([\w\d]([\w\d-])+\.){1,})([\w\d-]{2,})(/[\w\d\S\s]*)* 23 | colours=bold green 24 | ======= 25 | # phone 26 | regexp=\+([\d\.]*) 27 | colours=bold yellow 28 | ======= 29 | # email 30 | regexp=([\d\w\S])+@(([\w\d]([\w\d-])+\.){1,})([\w\d-]{2,}) 31 | colours=bold blue 32 | ======= 33 | # date 34 | regexp=([\d]{4}[- ](([\d]{2})|([a-zA-Z]{3,}))[ -][\d]{2})|([\d]{2}[ -](([a-zA-Z]{3,})|([\d]{2}))[ -][\d]{4}) 35 | colours=bold red 36 | ======= 37 | # time 38 | regexp=[\d]{2}:[\d]{2}:[\d]{2}((\.[\d]*[Z]?)|(\+[\d]*))? 39 | colours=red 40 | ======= 41 | # NOTICE 42 | regexp=NOTICE 43 | colours=bold blue 44 | ======= 45 | # TERM OF USE 46 | regexp=TERMS OF USE 47 | colours=bold blue 48 | ======= 49 | # registrar 50 | regexp=(Sponsoring )?[Rr]egistrar([\w\s\S])*: 51 | colours=bold cyan 52 | ======= 53 | # registrant 54 | regexp=(Registry )?[Rr]egistrant([\w\s\S])*: 55 | colours=bold blue 56 | ======= 57 | # admin 58 | regexp=(Registry )?[Aa]dmin([\w\s\S])*: 59 | colours=bold magenta 60 | ======= 61 | # tech 62 | regexp=(Registry )?[Tt]ech([\w\s\S])*: 63 | colours=bold yellow 64 | ======= 65 | # billing 66 | regexp=(Registry )?[Bb]illing([\w\s\S])*: 67 | colours=bold green 68 | ======= 69 | # NS 70 | regexp=((nserver)|(Name Server)): 71 | colours=bold green 72 | ======= 73 | # domain status 74 | regexp=(Domain Status)|(status) 75 | colours=bold red 76 | 77 | -------------------------------------------------------------------------------- /colourfiles/conf.yaml: -------------------------------------------------------------------------------- 1 | # Document 2 | regexp=--- 3 | colours=bold yellow 4 | - 5 | # First level 6 | regexp=^(\S+): 7 | colours=unchanged,blue 8 | - 9 | # Nested 10 | regexp=^ +(\S+): 11 | colours=unchanged,blue 12 | - 13 | # Set Var 14 | regexp=&\S+ 15 | colours=bold green 16 | - 17 | # Use Var 18 | regexp=\*\S+ 19 | colours=on_green black 20 | - 21 | # Array 22 | regexp=-\s 23 | colours=bold magenta 24 | - 25 | # << Inheritance 26 | regexp=<< 27 | colours=bold red 28 | - 29 | # Explicit String 30 | regexp="(\S*)(?=") 31 | colours=default,cyan 32 | - 33 | # Explicit Number 34 | regexp= (\d*)$ 35 | colours=unchanged,yellow 36 | -------------------------------------------------------------------------------- /contrib/conf.efingerd: -------------------------------------------------------------------------------- 1 | # contributed by Daniel Kollár 2 | 3 | # @host 4 | regexp=@\w+[\w\-\.]+\w+ 5 | colours=magenta 6 | count=once 7 | ====== 8 | # who fingers 9 | regexp=(\s\w+[\w\-\.]+)(?=@) 10 | colours=bold magenta 11 | count=once 12 | ====== 13 | # user null fingers 14 | regexp=\(null\) 15 | colours=green 16 | count=once 17 | ====== 18 | # who's fingered 19 | regexp=(\s\d\d\d\d\s)(\w+[\w\-\.]+\s(?=fingered)) 20 | colours=bold yellow 21 | count=once 22 | ====== 23 | # date and time 24 | regexp=^(...)(\s...\s.\d \d\d:\d\d:\d\d)(\s...\s\d\d\d\d\s) 25 | colours=green, green, bold green, green 26 | count=once 27 | -------------------------------------------------------------------------------- /contrib/mrsmith/README.md: -------------------------------------------------------------------------------- 1 | alternative configuration files for some commands, contributed by mrsmith 2 | 3 | -------------------------------------------------------------------------------- /contrib/mrsmith/conf.dig: -------------------------------------------------------------------------------- 1 | #comments 2 | regexp=;\s\w*\s*\w*.* 3 | colours=yellow 4 | ======= 5 | #comments 2 6 | regexp=;;\s\w*\s*\w*.* 7 | colours=white 8 | ======= 9 | #ipv6 10 | regexp=(([0-9a-fA-F]{1,4})?\:\:?[0-9a-fA-F]{1,4})+ 11 | colours=green 12 | ======= 13 | #time 14 | regexp=\s[0-9]{1,6}\s 15 | colours=red 16 | ======= 17 | #type 18 | regexp=\s(A|AAAA|NS|PTR|MX|CNAME|TXT|COA)(\s|$) 19 | colours=cyan 20 | ======= 21 | #in 22 | regexp=\s(IN|CH)\s 23 | colours=yellow 24 | ======= 25 | #domain 26 | regexp=@?([a-zA-Z0-9]([a-zA-Z0-9\-]{0,61}[a-zA-Z0-9])?\.)+[a-zA-Z]{2,6}\.? 27 | colours=magenta 28 | ======= 29 | #ip address 30 | regexp=\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3} 31 | colours=green 32 | #======= 33 | 34 | -------------------------------------------------------------------------------- /contrib/mrsmith/conf.ifconfig: -------------------------------------------------------------------------------- 1 | # ip 2 | regexp=\b(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\b 3 | colours=bold green 4 | ======= 5 | # ipv6 6 | regexp=(([0-9a-fA-F]{1,4})?\:\:?[0-9a-fA-F]{1,4})+ 7 | colours=bold green 8 | ======= 9 | # hwaddr 10 | regexp=([0-9a-fA-F][0-9a-fA-F]:){5}([0-9a-fA-F][0-9a-fA-F]) 11 | colours=yellow 12 | ======= 13 | # size 14 | regexp=\d+(\.\d+)?\s((T|G|M|K)i)?B 15 | colours=yellow 16 | ======= 17 | # interface 18 | regexp=(([0-9a-z]{3,8}\d)|lo): 19 | colours=bold green 20 | ======= 21 | #ip disc 22 | regexp=(inet6?|netmask|broadcast) 23 | colours=cyan 24 | ======= 25 | #flags 26 | regexp=(?<=[,<])[^,]*(?=[,>]) 27 | colours=blue 28 | ======= 29 | # mtu 30 | regexp=mtu\s\d+ 31 | colours=green 32 | ======= 33 | # unspec 34 | regexp=(unspec|UNSPEC) 35 | colours=bold red 36 | ======= 37 | #errors 38 | regexp=errors\s\d* 39 | colours=red 40 | ======= 41 | regexp=dropped\s\d* 42 | colours=white 43 | ======= 44 | regexp=overruns\s\d* 45 | colours=green 46 | ======= 47 | regexp=frame\s\d* 48 | colours=white 49 | ======= 50 | regexp=carrier\s\d* 51 | colours=cyan 52 | ======= 53 | regexp=collisions\s\d* 54 | colours=red 55 | -------------------------------------------------------------------------------- /contrib/mrsmith/conf.mtr: -------------------------------------------------------------------------------- 1 | #ip address 2 | regexp=\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3} 3 | colours=green 4 | ======= 5 | # % 0.0 - 10.9 % loss 6 | regexp=[^\d][0-9]{1}.\d% 7 | colours=green 8 | ======= 9 | # % 11.0 - 30.9 % loss 10 | regexp=[123]{1}[0-9]{1}.\d% 11 | colours=yellow 12 | ======= 13 | # % 30.0 - 80.9% loss 14 | regexp=[3-8]{1}[0-9]{1}.\d% 15 | colours=bold yellow 16 | ======= 17 | # % 80.0 - 95.9% loss 18 | regexp=[8-9]{1}[0-9]{1}.\d% 19 | colours=red 20 | ======= 21 | # unknow host 22 | regexp=\?\?\? 23 | colours=red 24 | ======= 25 | # Packets/Pings 26 | regexp=(Packets|Pings) 27 | colours=bold green 28 | -------------------------------------------------------------------------------- /contrib/mrsmith/conf.netstat: -------------------------------------------------------------------------------- 1 | # hostname:service 2 | regexp=(\S*):(\d{1,5}|\S*)\s 3 | colours=yellow, bold green, bold yellow 4 | ======= 5 | # ipx hostname 6 | regexp=^IPX.*[\dABCDEF]+:[\dABCDEF]+ 7 | colours=green 8 | ======= 9 | # protocols TCP 10 | regexp=tcp6? 11 | colours=bold blue 12 | ======= 13 | # protocols UDP 14 | regexp=udp6? 15 | colours=bold cyan 16 | ======= 17 | # protocols other 18 | regexp=(^unix|^IPX|STREAM|DGRAM|SEQPACKET) 19 | colours=bold green 20 | ======= 21 | # status 22 | regexp=FIN_WAIT.* 23 | colours=red 24 | ======= 25 | # status 26 | regexp=SYN.*? 27 | colours=bold red 28 | ======= 29 | # status 30 | regexp=LISTEN(ING)? 31 | colours=bold blue 32 | ======= 33 | # status 34 | regexp=TIME_WAIT 35 | colours=bold red 36 | ======= 37 | # status 38 | regexp=CLOS(E(_WAIT)?|ING) 39 | colours=red 40 | skip=yes 41 | ======= 42 | # status 43 | regexp=LAST_ACK 44 | colours=red 45 | ======= 46 | # status 47 | regexp=ESTAB.*?\b|CONNECTED 48 | colours=bold yellow 49 | ======= 50 | # status 51 | regexp=FREE 52 | colours=bold green 53 | ======= 54 | # status 55 | regexp=DISCONNECTING 56 | colours=red 57 | ======= 58 | # status 59 | regexp=CONNECTING 60 | colours=green 61 | ======= 62 | # status 63 | regexp=UNKNOWN 64 | colours=blink bold red 65 | ======= 66 | # path 67 | regexp=(\@)[\dabcdef]+ 68 | colours=green, bold green 69 | ======= 70 | # timewait 71 | regexp=timewait\s\((.*\)) 72 | colours=green, red 73 | ======= 74 | # timewait off 75 | regexp=off.* 76 | colours=bold red 77 | ======= 78 | # process name 79 | regexp=\s(\d*)/(\S*)\s 80 | colours=yellow,bold cyan, bold green 81 | -------------------------------------------------------------------------------- /contrib/mrsmith/conf.ps: -------------------------------------------------------------------------------- 1 | # CAPS LINE 2 | regexp=^[A-Z\s%]*([A-Z]{3})[A-Z\s%]*$ 3 | colours=underline 4 | ======= 5 | # /full/path 6 | regexp=(\s|^)/[-\w\d.]+/[-\w\d./]+ 7 | colours=white 8 | ======= 9 | # Capd Line 10 | regexp=^([A-Z][-a-z0-9]+(\s+|$)){3,}$ 11 | colours=underline 12 | ======= 13 | # VMSTAT 14 | regexp=(\s|^)\d+([.,]\d+)?(?=[\s,]|$) 15 | colours=bold green 16 | ======= 17 | # n.n.n 18 | regexp=(\s|^)\d+\.\d+\.\d+(?=[\s,]|$) 19 | colours=bold cyan 20 | ======= 21 | # text: 22 | regexp=^([-a-z0-9]+):\s 23 | colours=unchanged,yellow 24 | ======= 25 | # -options 26 | regexp=(?<=\s)-[\w\d]+(?=\s|$) 27 | colours=yellow 28 | ======= 29 | # --long-option= 30 | regexp=(?<=\s)--[-\w\d]+[\w\d](?==|\s|$)(=?) 31 | colours=cyan,white 32 | ======= 33 | # [text] 34 | regexp=\[[-\w\d:/]+\] 35 | colours=cyan 36 | ======= 37 | # root user 38 | regexp=root|wheel(?=\s|$) 39 | colours=red 40 | ======= 41 | # pts 42 | regexp=(\s|^)pts/\d+(?=[^\w\d]|$) 43 | colours=bold yellow 44 | ======= 45 | # tty 46 | regexp=(\s|^)tty\d+(?=[^\w\d]|$) 47 | colours=bold cyan 48 | ======= 49 | # time 50 | regexp=(\d*:)?\d*:\d{2} 51 | colours=bold white 52 | ======= 53 | # time 00:00:00 54 | regexp=00:00:00 55 | colours=bold black 56 | ====== 57 | # time 0:00 58 | regexp=\s0:00\s 59 | colours=bold black 60 | ====== 61 | # ? 62 | regexp=\s\?\s 63 | colours=red 64 | ======= 65 | # Process state 66 | regexp=\s([DRSTEXZ])([NLsl+<]*)\s 67 | colours=cyan, bold blue 68 | -------------------------------------------------------------------------------- /contrib/nmh-in-color/README: -------------------------------------------------------------------------------- 1 | -------------- 2 | COLORIZING nmh 3 | -------------- 4 | 5 | I've been using nmh on Linux for a few years now, it is a powerful mail 6 | handling system maintained by a team of volunteers. The latest version can 7 | be found at: http://www.mhost.com/nmh/ 8 | 9 | A few months ago I discovered grc, a very cool "generic colouriser", 10 | written by Radovan Garabik 11 | http://melkor.dnp.fmph.uniba.sk/~garabik/grc.html 12 | 13 | Since I'm hooked on nmh, I decided to use grc with it. 14 | Here's a list of the files needed: 15 | 16 | The latest version of these files can be found at: 17 | http://users.anet.com/~mig/nmh-in-color/nmh-in-color.tar.gz 18 | 19 | configs/ 20 | bashrc-entries Example alias entries for a ~/.bashrc file. 21 | conf.flists grc config for flists command. 22 | conf.inc grc config for inc command. 23 | conf.mail grc config for show command. 24 | conf.scan grc config for scan command. 25 | grc.conf-entries sample entries for use in grc.conf 26 | mh_profile-entries sample entries for use in ~/.mh_profile 27 | mhl.body sample format file for MIME message body 28 | mhl.format sample format file for show command 29 | mhl.headers sample format file for MIME message headers 30 | rxvt-resources rxvt settings from ~/.Xdefaults used for the 31 | screenshots 32 | scripts/ 33 | viewmail Script for viewing colorized e-mail. 34 | vimail Script to call vim in mail-syntax mode. 35 | 36 | ------------ 37 | INSTALLATION 38 | ------------ 39 | 40 | Grab nmh-1.0.x.tar.gz, and grc_0.x.tar.gz from the websites above. Read the 41 | documentation included with the packages and install them. Grc requires a 42 | Python interpreter. I tested with grc_0.81 and Python-1.5.1. 43 | 44 | Copy the conf.* files to /usr/share/grc/ or /usr/local/share/grc/, depending 45 | on how grc was installed. 46 | 47 | Copy viewmail and vimail somewhere in your path, like ~/bin/. Note vimail 48 | does not use grc, but makes use of vim-5.x syntax-highlighting. You may have 49 | to modify the path to the syntax description files given in the script to 50 | match your system. If you only want to colorize email-viewing, or you don't 51 | use vim to compose messages, don't install vimail. 52 | 53 | Add the contents of bashrc-entries to your ~/.bashrc, and the contents of 54 | mh_profile-entries to your ~/.mh_profile (look these over first, some of these 55 | profile entries are just my personal preference). Also, add grc.conf-entries 56 | to /etc/grc.conf. 57 | 58 | I recommend the use of rxvt (http://www.rxvt.org). I've included the settings 59 | from my .Xdefaults file in rxvt-resources (don't forget to do a xrdb -load 60 | .Xdefaults after you put these in place). 61 | 62 | -------- 63 | COMMENTS 64 | -------- 65 | 66 | The color-scheme I've used in the conf.* files is optimized for light text on 67 | a dark background. Please feel free to make modifications. 68 | 69 | Enjoy! 70 | 71 | Miguel Gualdron (August 2000) 72 | mig@anet.com 73 | http://users.anet.com/~mig/nmh-in-color 74 | 75 | #--------------------------------------------------------------------------- 76 | # README file for nmh-in-color.tar.gz 77 | # $Id: README,v 1.7 2001/01/19 03:32:30 mig Exp mig $ 78 | #--------------------------------------------------------------------------- 79 | -------------------------------------------------------------------------------- /contrib/nmh-in-color/configs/bashrc-entries: -------------------------------------------------------------------------------- 1 | #---------------------------------------------------------------------- 2 | # This alias shows all my mail folders, highlighting (in yellow) 3 | # those which have new mail in them. 4 | #---------------------------------------------------------------------- 5 | alias flists="grc flists" 6 | 7 | #---------------------------------------------------------------------- 8 | # I use Procmail to sort my incoming mail into nmh folders, this alias 9 | # shows me only the folders that have new mail in them: 10 | #---------------------------------------------------------------------- 11 | alias fl="flists -seq unseen -noshowzero -recurse" 12 | 13 | #---------------------------------------------------------------------- 14 | # Since I use procmail(1), I don't use inc(1) much... 15 | #---------------------------------------------------------------------- 16 | alias inc="grc inc" 17 | 18 | #---------------------------------------------------------------------- 19 | # I like to have a header on the the scan(1) output so I know where I am. 20 | # Feel free to change any of the colors in the conf-* files... 21 | #---------------------------------------------------------------------- 22 | alias scan="grc scan -header" 23 | 24 | #---------------------------------------------------------------------- 25 | # Just a shortcut for the inbox: 26 | #---------------------------------------------------------------------- 27 | alias si="scan +inbox" 28 | -------------------------------------------------------------------------------- /contrib/nmh-in-color/configs/conf.flists: -------------------------------------------------------------------------------- 1 | #--------------------------------------------------------------------------- 2 | # $Id: conf.flists,v 1.5 2001/01/19 03:04:38 mig Exp mig $ 3 | #--------------------------------------------------------------------------- 4 | # GRC config file for use with nmh(1) command flists(1). 5 | #--------------------------------------------------------------------------- 6 | # Unread messages: 7 | regexp=.*has\s+([0-9]+[0-9]|[1-9])\sin.* 8 | colours=yellow 9 | count=more 10 | - 11 | # Current folder: 12 | regexp=.*\+\s+.* 13 | colours=green 14 | count=once 15 | -------------------------------------------------------------------------------- /contrib/nmh-in-color/configs/conf.inc: -------------------------------------------------------------------------------- 1 | #--------------------------------------------------------------------------- 2 | # $Id: conf.inc,v 1.5 2001/01/20 00:00:57 mig Exp mig $ 3 | #--------------------------------------------------------------------------- 4 | # GRC config file for use with nmh(1) command inc(1). 5 | #--------------------------------------------------------------------------- 6 | # Replies... 7 | regexp=\s+R[Ee]:\s+.* 8 | colours=blue 9 | count=more 10 | - 11 | # Current message: 12 | regexp=^\s{0,3}\d{1,5}\+.* 13 | colours=green 14 | count=once 15 | -------------------------------------------------------------------------------- /contrib/nmh-in-color/configs/conf.mail: -------------------------------------------------------------------------------- 1 | #--------------------------------------------------------------------------- 2 | # $Id: conf.mail,v 3.3 2001/01/19 03:10:13 mig Exp mig $ 3 | #------------------------------------------------------------------------- 4 | # This configuration file is suitable for displaying mail files. 5 | # Such as when mail is read with mh(1) or nmh(1). 6 | # 7 | # This version makes more use of the block count to avoid listing all of 8 | # the possible header lines... 9 | #------------------------------------------------------------------------- 10 | # The Date, will be green. 11 | #------------------------------------------------------------------------- 12 | regexp=^\s*(Date|Sent):.* 13 | colours=green 14 | count=stop 15 | - 16 | #------------------------------------------------------------------------- 17 | # The To, CC, BCC, and From, etc. lines will be green. 18 | #------------------------------------------------------------------------- 19 | regexp=^\s*((In-)?([Rr]eply-)?[Tt]o|From|Author|[BbFf]?[Cc][Cc]): 20 | colours=green 21 | count=more 22 | - 23 | #------------------------------------------------------------------------- 24 | # The Subject line will be red. 25 | #------------------------------------------------------------------------- 26 | regexp=^\s*Subject:.*$ 27 | colours=bold red 28 | count=stop 29 | - 30 | #------------------------------------------------------------------------- 31 | # Long lines: 32 | #------------------------------------------------------------------------- 33 | regexp=^\s{5}\*\*\*.*$ 34 | colours=previous 35 | count=previous 36 | - 37 | #------------------------------------------------------------------------- 38 | # Header lines added by nmh: 39 | #------------------------------------------------------------------------- 40 | regexp=^\s*Replied:.*$ 41 | colours=cyan 42 | count=more 43 | - 44 | #------------------------------------------------------------------------- 45 | # Other mail header lines will be yellow. 46 | #------------------------------------------------------------------------- 47 | regexp=^(([Xx]-{0,1}.*\S)|((Return-)?Path)|(MIME-{0,1}.*\S)):.*$ 48 | colours=yellow 49 | count=block 50 | - 51 | #------------------------------------------------------------------------- 52 | # Multi-line signatures: 53 | #------------------------------------------------------------------------- 54 | regexp=^-{1,3}\s{0,1}$ 55 | colours=red 56 | count=block 57 | - 58 | regexp=^={1,5}\s{0,1}$ 59 | colours=red 60 | count=block 61 | - 62 | regexp=^-=-\s{0,1}$ 63 | colours=red 64 | count=block 65 | - 66 | #------------------------------------------------------------------------- 67 | # This unblock applies to all of the block lines above: 68 | #------------------------------------------------------------------------- 69 | regexp=^\s{0,5}$ 70 | colours=default 71 | count=unblock 72 | - 73 | #--------------------------------------------------------------------------- 74 | # This will make most separating lines blue: 75 | #--------------------------------------------------------------------------- 76 | regexp=^.*([-=_!#$*<=>.:/|\\~`] *){7}.*$ 77 | colours=blue 78 | count=more 79 | - 80 | #------------------------------------------------------------------------- 81 | # Any quoted messages will show up in blue if quoted an odd number of times, 82 | # cyan if quoted an even number of times. The main message text will remain 83 | # unchanged. 84 | # 85 | # (I grabbed these regexp's from the vim-5.x mail.vim file.) 86 | #------------------------------------------------------------------------- 87 | regexp=^[ \t]*([A-Za-z]+>|[\]|}>#:]).*$ 88 | colours=blue 89 | count=more 90 | - 91 | regexp=^[ \t]*(([A-Za-z]+>|[\]|}>#:])[ \t]*){2}.*$ 92 | colours=cyan 93 | count=more 94 | - 95 | regexp=^[ \t]*(([A-Za-z]+>|[\]|}>#:])[ \t]*){3}.*$ 96 | colours=blue 97 | count=more 98 | - 99 | regexp=^[ \t]*(([A-Za-z]+>|[\]|}>#:])[ \t]*){4}.*$ 100 | colours=cyan 101 | count=more 102 | - 103 | regexp=^[ \t]*(([A-Za-z]+>|[\]|}>#:])[ \t]*){5}.*$ 104 | colours=blue 105 | count=more 106 | - 107 | regexp=^[ \t]*(([A-Za-z]+>|[\]|}>#:])[ \t]*){6}.*$ 108 | colours=cyan 109 | count=more 110 | - 111 | #------------------------------------------------------------------------- 112 | # Highlight URLs in magenta and email addresses in green: 113 | #------------------------------------------------------------------------- 114 | regexp=\b\S+@\S+\b 115 | colours=green 116 | count=more 117 | - 118 | regexp=mailto:\S+@\S+\b 119 | colours=green 120 | count=more 121 | - 122 | regexp=https?:\/\/\S+\b 123 | colours=magenta 124 | count=more 125 | - 126 | regexp=ftp:\/\/\S+\b 127 | colours=magenta 128 | count=more 129 | - 130 | regexp=file:\/\/\S+\b 131 | colours=magenta 132 | count=more 133 | -------------------------------------------------------------------------------- /contrib/nmh-in-color/configs/conf.scan: -------------------------------------------------------------------------------- 1 | #--------------------------------------------------------------------------- 2 | # $Id: conf.scan,v 1.6 2001/01/20 00:01:32 mig Exp mig $ 3 | #--------------------------------------------------------------------------- 4 | # GRC config file for use with nmh(1) command scan(1). 5 | # 6 | # This file works well with the scan.unseen file provided with nmh(1). 7 | #--------------------------------------------------------------------------- 8 | # The header line: 9 | regexp=^FOLDER.* 10 | colours=green 11 | count=once 12 | - 13 | # Messages replied-to by me: 14 | regexp=^\s{0,3}\d{1,5}\s+-.* 15 | colours=cyan 16 | count=more 17 | - 18 | # Replies... 19 | regexp=\s+R[Ee]:\s+.* 20 | colours=blue 21 | count=more 22 | - 23 | # Unread messages: 24 | regexp=^\s{0,3}\d{1,5}\sU\s.{23} 25 | colours=yellow 26 | count=more 27 | - 28 | # Current message: 29 | regexp=^\s{0,3}\d{1,5}\+.* 30 | colours=green 31 | count=once 32 | -------------------------------------------------------------------------------- /contrib/nmh-in-color/configs/grc.conf-entries: -------------------------------------------------------------------------------- 1 | # 2 | # Add these entries to the /etc/grc.conf file, so grc does the right thing 3 | # when the scan, flists, and inc commands are used. 4 | # 5 | # scan command 6 | (^|[/\w\.]+/)scan\b 7 | conf.scan 8 | 9 | # flists command 10 | (^|[/\w\.]+/)flists\b 11 | conf.flists 12 | 13 | # inc command 14 | (^|[/\w\.]+/)inc\b 15 | conf.inc 16 | -------------------------------------------------------------------------------- /contrib/nmh-in-color/configs/mh_profile-entries: -------------------------------------------------------------------------------- 1 | #: 2 | #: The .mh_profile entries listed below may be useful when using 3 | #: nmh with grc/grcat. 4 | #: 5 | moreproc: viewmail 6 | Unseen-Sequence: unseen 7 | scan: -form scan.unseen 8 | comp: -editor vimail 9 | repl: -annotate -nocc all -fcc sent-mail -filter reply.filter -editor vimail 10 | forw: -editor forwedit -format 11 | forwedit: -editor vimail 12 | flists: -recurse 13 | mhshow-show-text/html: lynx -dump -force_html '%f' |viewmail 14 | -------------------------------------------------------------------------------- /contrib/nmh-in-color/configs/mhl.body: -------------------------------------------------------------------------------- 1 | body:nocomponent,width=79,overflowtext="*** ",overflowoffset=5,noleftadjust 2 | -------------------------------------------------------------------------------- /contrib/nmh-in-color/configs/mhl.format: -------------------------------------------------------------------------------- 1 | ; mhl.format 2 | ; 3 | ; This is a slighly modified version of the default mhl.format file included 4 | ; with nmh-1.0.x. I've added "width=79,overflowtext='*** '" to the "body" 5 | ; line at the bottom. I've also made the the overflowtext string "*** " 6 | ; instead of the default "***" to improve readability. 7 | ; 8 | ; Miguel Gualdron (July 2000). 9 | ; 10 | : 11 | overflowtext="*** ",overflowoffset=5 12 | leftadjust,compwidth=9 13 | ignores=msgid,message-id,received,content-type,content-transfer-encoding,content-id 14 | Date:formatfield="%<(nodate{text})%{text}%|%(pretty{text})%>" 15 | To: 16 | cc: 17 | From:decode 18 | Subject:decode 19 | : 20 | extras:nocomponent 21 | : 22 | body:nocomponent,width=79,overflowtext="*** ",overflowoffset=5,noleftadjust 23 | -------------------------------------------------------------------------------- /contrib/nmh-in-color/configs/mhl.headers: -------------------------------------------------------------------------------- 1 | ; mhl.headers 2 | ; 3 | ; Slighly modified version of the default mhl.headers file included with 4 | ; nmh-1.0.x. See the comments at the top of mhl.format for more details. 5 | ; 6 | ; Format file for displaying headers in 7 | ; MIME messages. mhn calls the mhlproc with this 8 | ; filter to display message header. 9 | ; 10 | overflowtext="*** ",overflowoffset=5 11 | leftadjust,compwidth=9 12 | ignores=msgid,message-id,received,content-type,content-transfer-encoding,content-id 13 | Date:formatfield="%<(nodate{text})%{text}%|%(pretty{text})%>" 14 | To: 15 | cc: 16 | From:decode 17 | Subject:decode 18 | : 19 | extras:nocomponent 20 | : 21 | -------------------------------------------------------------------------------- /contrib/nmh-in-color/configs/rxvt-resources: -------------------------------------------------------------------------------- 1 | !-------------------------------------------------------------- 2 | ! These are the resource settings I use with rxvt(1), 3 | ! they were in place when the screenshots were generated. 4 | ! 5 | ! If you prefer your terminal windows with dark text on 6 | ! a light background, you'll have to tweak the colors here, as 7 | ! well as in the grc conf-* files. 8 | !----------------- 9 | ! Rxvt settings 10 | !----------------- 11 | Rxvt*background: black 12 | Rxvt*foreground: gray70 13 | Rxvt*color4: #1e90ff 14 | Rxvt*color12: #63b8ff 15 | Rxvt*colorBD: #63b8ff 16 | Rxvt*colorUL: #00ffff 17 | ! 18 | !-------------------------------------------------------------- 19 | ! The following settings have a similar effect on 20 | ! xterm(1). 21 | !----------------- 22 | ! Xterm settings 23 | !----------------- 24 | XTerm*background: black 25 | XTerm*foreground: gray70 26 | XTerm*colorBDMode: on 27 | XTerm*color4: #1e90ff 28 | XTerm*color12: #63b8ff 29 | XTerm*colorBD: #63b8ff 30 | XTerm*colorUL: #00ffff 31 | -------------------------------------------------------------------------------- /contrib/nmh-in-color/scripts/viewmail: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # 3 | #--------------------------------------------------------------------------- 4 | # $Id: viewmail,v 1.4 2000/08/19 00:23:32 mig Exp mig $ 5 | #---------------------------------------------------------------------- 6 | # Script Name: viewmail 7 | # Purpose: Short script to page through and colorize email. 8 | # 9 | #---------------------------------------------------------------------- 10 | 11 | 12 | #--------------------------------------------------------------------------- 13 | # If we're sending output to a terminal, then colorize it, 14 | # otherwise, just cat it (...in case we're piping to lpr, etc.). 15 | # 16 | # Assume the input comes from STDIN. If we get command-line arguments, 17 | # then we assume they're filenames, and cat them each in turn. 18 | #--------------------------------------------------------------------------- 19 | if [ -t 1 ]; then 20 | if [ $# -eq 0 ]; then 21 | grcat conf.mail | less -r 22 | else 23 | for _arg in $* 24 | do 25 | grcat conf.mail < $_arg | less -r 26 | done 27 | fi 28 | else 29 | if [ $# -eq 0 ]; then 30 | cat 31 | else 32 | for _arg in $* 33 | do 34 | cat $_arg 35 | done 36 | fi 37 | fi 38 | -------------------------------------------------------------------------------- /contrib/nmh-in-color/scripts/vimail: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # 3 | #--------------------------------------------------------------------------- 4 | # $Id: vimail,v 1.3 2000/08/19 00:25:17 mig Exp mig $ 5 | #--------------------------------------------------------------------------- 6 | # Script Name: vimail 7 | # Purpose: Short script to edit mail from nmh(1) 8 | # This script makes use if vim-5.x syntax highlighting. 9 | # 10 | #--------------------------------------------------------------------------- 11 | if [ $# = 0 ]; then 12 | vi +'so $VIM/syntax/mail.vim' - 13 | else 14 | vi +'so $VIM/syntax/mail.vim' $* 15 | fi 16 | -------------------------------------------------------------------------------- /contrib/wrap-ccache: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | # by Alexey Galakhov 4 | 5 | wd="`dirname $0`" 6 | ccache="`which ccache`" 7 | grc="`which grc`" 8 | grconf="conf.gcc" 9 | if [ "`basename $1`" = "configure" ]; then 10 | ccache="" 11 | grconf="conf.configure" 12 | fi 13 | 14 | gropts="" 15 | if perl -e 'use POSIX "isatty"; exit !isatty(1);'; then 16 | gropts="$gropts --stdout" 17 | fi 18 | if perl -e 'use POSIX "isatty"; exit !isatty(2);'; then 19 | gropts="$gropts --stderr" 20 | fi 21 | 22 | if [ ! -z "$grc" -a ! -z "$gropts" ]; then 23 | grc="$grc -s -e -c $wd/$grconf" 24 | else 25 | grc="" 26 | fi 27 | 28 | exec $grc $ccache "$@" 29 | -------------------------------------------------------------------------------- /debian/changelog: -------------------------------------------------------------------------------- 1 | grc (1.13.1-1) unstable; urgency=low 2 | 3 | * fix `ip addr` broadcast colouring 4 | 5 | -- Radovan Garabík Sun, 22 Aug 2021 13:36:39 +0200 6 | 7 | grc (1.13-2) unstable; urgency=medium 8 | 9 | * Source only upload (closes: #983793) 10 | 11 | -- Radovan Garabík Fri, 20 Aug 2021 16:38:48 +0200 12 | 13 | grc (1.13-1) unstable; urgency=low 14 | 15 | * do not add sh aliases unless explicitly allowed in /etc/default/grc 16 | (closes: #984629) 17 | * several minor improvements 18 | 19 | -- Radovan Garabík Sat, 07 Aug 2021 17:37:55 +0200 20 | 21 | grc (1.12-1) unstable; urgency=low 22 | 23 | * add new configurations 24 | * improved zsh alias support 25 | * various small bugfixes and improvements 26 | 27 | -- Radovan Garabík Mon, 01 Mar 2021 09:41:35 +0100 28 | 29 | grc (1.11.3-1) unstable; urgency=medium 30 | 31 | * add new configurations 32 | * --colour=auto is now the default 33 | * add dh-python build dependency (closes: #896743) 34 | 35 | -- Radovan Garabík Sun, 29 Apr 2018 16:12:14 +0200 36 | 37 | grc (1.11.2-1) unstable; urgency=low 38 | 39 | * add ntpdate configuration command 40 | 41 | -- Radovan Garabík Sat, 23 Sep 2017 20:35:33 +0200 42 | 43 | grc (1.11.1-2) unstable; urgency=low 44 | 45 | * fixed python2 compatibility errors (forgotten old changelog commit) 46 | -- Radovan Garabík Wed, 07 Jun 2017 15:01:11 +0200 47 | 48 | grc (1.11.1-1) unstable; urgency=low 49 | 50 | * fixed python2 compatibility errors 51 | 52 | -- Radovan Garabík Sun, 21 May 2017 16:01:51 +0200 53 | 54 | grc (1.11-1) unstable; urgency=low 55 | 56 | * clean up directories 57 | * improve some configuration files 58 | 59 | -- Radovan Garabík Fri, 21 Apr 2017 11:06:13 +0200 60 | 61 | grc (1.10.1-1) unstable; urgency=low 62 | 63 | * make aliases more compatible with zsh anc MacOSX 64 | 65 | -- Radovan Garabík Sat, 04 Mar 2017 10:04:12 +0100 66 | 67 | grc (1.10-1) unstable; urgency=low 68 | 69 | * many configuration files added 70 | * python3 compatible 71 | 72 | -- Radovan Garabík Sat, 28 Jan 2017 15:48:58 +0100 73 | 74 | grc (1.9-1) unstable; urgency=low 75 | 76 | * add `colors' as a synonym of `colours' (and the singulars, too) 77 | 78 | -- Radovan Garabík Tue, 31 Mar 2015 17:44:11 +0200 79 | 80 | grc (1.8-1) unstable; urgency=low 81 | 82 | * added support for Ki, Gi, Ti for df (thanks to Juraj Bednár) 83 | * added example aliases for bash (thanks to Juraj Bednár) 84 | * fix infinite loop if regexp matches but does not consume anything 85 | 86 | -- Radovan Garabík Mon, 16 Mar 2015 14:38:42 +0100 87 | 88 | grc (1.7-1) unstable; urgency=low 89 | 90 | * added `replace' keyword to replace arbitrary text (idea by Ben Hoskins) 91 | * added config.php to display php error log (thanks to Ben Hoskins) 92 | * added aixterm bright colour codes (thanks to April Arcus) 93 | * minor cleanups 94 | * switch to non-native Debian package 95 | 96 | -- Radovan Garabík Fri, 27 Feb 2015 11:09:48 +0100 97 | 98 | grc (1.6) unstable; urgency=low 99 | 100 | * add several configuration files (thanks to Mrs. Smith) 101 | 102 | -- Radovan Garabík Wed, 30 Oct 2013 15:15:20 +0100 103 | 104 | grc (1.5) unstable; urgency=low 105 | 106 | * added configuration file for the 'mount' command (thanks to Emanuele Aina) 107 | * catch SIGPIPE in grcat (closes: #689705), 108 | thanks to Дмитрий Кацубо for pointing this out 109 | * add several configuration files (thanks to Dark Wizard) 110 | * preliminary python3 support (thanks to Dark Wizard and Andreas Niederl), 111 | as a consequence, grc requires at least python2.6 112 | 113 | -- Radovan Garabík Sat, 10 Aug 2013 14:23:01 +0200 114 | 115 | grc (1.4) unstable; urgency=low 116 | 117 | * fix grcat argument search path, 118 | thanks to Andrzej Polis and Алексей Галахов 119 | * added conf.configure, thanks to Алексей Галахов 120 | * IPv6 support for ping6 and traceroute6 121 | 122 | -- Radovan Garabík Sat, 14 May 2011 14:39:43 +0200 123 | 124 | grc (1.3) unstable; urgency=low 125 | 126 | * propagate CTRL+C properly to the command being executed 127 | (for i in range(100): print "I'll never use wildcard 'except:' again") 128 | * if grcat argument starts with ./, search in current working directory 129 | * fix unified diff configuration to include also single '-', 130 | thanks to Markus Klinik for noticing 131 | 132 | -- Radovan Garabík Wed, 8 Jul 2009 20:29:06 +0200 133 | 134 | grc (1.2) unstable; urgency=low 135 | 136 | * properly redirect stderr, thanks to Алексей Галахов 137 | * fix several minor pylint warnings 138 | 139 | -- Radovan Garabík Thu, 14 May 2009 19:21:00 +0200 140 | 141 | grc (1.1) unstable; urgency=low 142 | 143 | * added several non-standard escape attributes (thanks to James Rowe) 144 | 145 | -- Radovan Garabík Sat, 31 Mar 2007 21:25:02 +0200 146 | 147 | grc (1.0.9) unstable; urgency=low 148 | 149 | * added configuration file for the cvs command (thanks to Andreas Niederl) 150 | * modify diff configuration file to colour the filenames 151 | as well (thanks to Andreas Niederl) 152 | 153 | -- Radovan Garabík Thu, 4 Jan 2007 20:45:12 +0100 154 | 155 | grc (1.0.8) unstable; urgency=low 156 | 157 | * add the possibility to include arbitrary string as the colourifying 158 | sequence 159 | 160 | -- Radovan Garabík Mon, 11 Sep 2006 09:58:54 +0200 161 | 162 | grc (1.0.7) unstable; urgency=low 163 | 164 | * do not use sys.maxint, it caused problems 165 | * improve ping conffile, thanks to Michael Kebe (closes: #378981) 166 | 167 | -- Radovan Garabík Sat, 22 Jul 2006 08:56:56 +0200 168 | 169 | grc (1.0.6) unstable; urgency=low 170 | 171 | * applied patch that causes grcat to complain and exits when grcat can't find the 172 | config file (thanks to Tripp Lilley ) 173 | 174 | -- Radovan Garabík Tue, 4 Mar 2003 13:42:47 +0100 175 | 176 | grc (1.0.5) unstable; urgency=low 177 | 178 | * add "unchanged" colour 179 | (thanks to Jehan Bing ) 180 | 181 | -- Radovan Garabik Tue, 4 Feb 2003 14:29:55 +0100 182 | 183 | grc (1.0.4) unstable; urgency=low 184 | 185 | * do not require $HOME to be set (closes: #158316) 186 | 187 | -- Radovan Garabik Wed, 4 Sep 2002 13:44:41 +0200 188 | 189 | grc (1.0.3) unstable; urgency=low 190 | 191 | * added configuration file for colourising diff outputs 192 | (thanks to Dr. Rafael Sepúlveda ) 193 | 194 | -- Radovan Garabik Sun, 18 Aug 2002 19:35:34 +0200 195 | 196 | grc (1.0.2) unstable; urgency=low 197 | 198 | * package updated for new python version in debian 199 | * if grc is run without any arguments, display helpful 200 | message (closes: #108675) 201 | * do not include INSTALL in debian documentation (closes: #94053) 202 | 203 | -- Radovan Garabik Sun, 21 Oct 2001 14:43:11 +0200 204 | 205 | grc (1.0.1) unstable; urgency=low 206 | 207 | * included rpm spec file, conf.ldap, modified grc.conf - all 208 | thanks to Christian Zuckschwerdt 209 | 210 | -- Radovan Garabik Wed, 28 Feb 2001 21:56:02 +0100 211 | 212 | grc (1.0) unstable; urgency=low 213 | 214 | * moved Build-Depends where it belongs 215 | * OK, this seems pretty stable already.... first stable version :-) 216 | 217 | -- Radovan Garabik Fri, 23 Feb 2001 21:27:55 +0100 218 | 219 | grc (0.999) unstable; urgency=low 220 | 221 | * grc terminates with the exit status of subprogram 222 | * my e-mail added to README file :-) 223 | * license changed 224 | 225 | -- Radovan Garabik Mon, 12 Feb 2001 18:01:24 +0100 226 | 227 | grc (0.99) unstable; urgency=low 228 | 229 | * candidate for stable version 230 | * corrected two stupid bugs when using skip option (closes: #84007) 231 | * upgraded nmh-in-color, by Miguel Gualdron 232 | 233 | -- Radovan Garabik Tue, 30 Jan 2001 15:06:57 +0100 234 | 235 | grc (0.9) unstable; urgency=low 236 | 237 | * grc catches ctrl C and propagates to subprocess (Closes: #81137) 238 | * added skip keyword to skip lines in output containing certain patterns 239 | 240 | -- Radovan Garabik Thu, 18 Jan 2001 10:12:38 +0100 241 | 242 | grc (0.8.1) unstable; urgency=low 243 | 244 | * typo in manpages fixed, closes: #70498 245 | 246 | -- Radovan Garabik Tue, 29 Aug 2000 14:20:14 +0200 247 | 248 | grc (0.8) unstable; urgency=low 249 | 250 | * added patches from Miguel Gualdron for 251 | colourising multiline blocks of text and making current colour 252 | dependent on previous line 253 | 254 | -- Radovan Garabik Sun, 27 Aug 2000 09:47:17 +0200 255 | 256 | grc (0.7) unstable; urgency=low 257 | 258 | * redirecting both stdout and stderr works 259 | I do not know what was the error, but I made it differently and it works :-) 260 | 261 | -- Radovan Garabik Tue, 23 May 2000 21:35:46 +0200 262 | 263 | grc (0.6) unstable; urgency=low 264 | 265 | * rewritten grc to use fork() and exec() 266 | * introduce --colour= option, to colourise depending on stdout being a tty (closes #62365) 267 | 268 | -- Radovan Garabik Sun, 7 May 2000 19:42:30 +0200 269 | 270 | grc (0.5) unstable; urgency=low 271 | 272 | * a bit of speed optimization 273 | * added a few (2) more configuration files 274 | * added debhelper to Build-Depends 275 | * upgraded Standards-Version 276 | 277 | -- Radovan Garabik Mon, 14 Feb 2000 12:23:29 +0100 278 | 279 | grc (0.4) unstable; urgency=low 280 | 281 | * change of configuration file format 282 | * added use of different colours per different regexp groups 283 | * added execution of external commands if regexp matches 284 | 285 | -- Radovan Garabik Mon, 22 Nov 1999 19:13:05 +0100 286 | 287 | grc (0.3) unstable; urgency=low 288 | 289 | * enable nested and overlaped regular expressions - this fixes a few 290 | display glitches 291 | 292 | -- Radovan Garabik Wed, 27 Oct 1999 22:32:58 +0200 293 | 294 | grc (0.2) unstable; urgency=low 295 | 296 | * grc can redirect stderr as well 297 | * background and other attributes (blink, bold) can be changed too 298 | * documentation update 299 | 300 | -- Radovan Garabik Tue, 26 Oct 1999 18:02:28 +0200 301 | 302 | grc (0.1) unstable; urgency=low 303 | 304 | * Initial Release. 305 | 306 | -- Radovan Garabik Thu, 14 Oct 1999 19:24:25 +0200 307 | 308 | Local variables: 309 | mode: debian-changelog 310 | End: 311 | -------------------------------------------------------------------------------- /debian/compat: -------------------------------------------------------------------------------- 1 | 10 2 | -------------------------------------------------------------------------------- /debian/control: -------------------------------------------------------------------------------- 1 | Source: grc 2 | Section: text 3 | Priority: optional 4 | Maintainer: Radovan Garabík 5 | Standards-Version: 4.5.1 6 | Build-Depends: debhelper (>=9), python3, dh-python 7 | 8 | Package: grc 9 | Architecture: all 10 | Depends: ${python3:Depends}, ${misc:Depends} 11 | Description: generic colouriser for everything 12 | generic colouriser, can be used to colourise logfiles, 13 | output of commands, arbitrary text.... 14 | configured via regexp's. 15 | -------------------------------------------------------------------------------- /debian/copyright: -------------------------------------------------------------------------------- 1 | This is grc, written and maintained by Radovan Garabík 2 | on Thu, 14 Oct 1999 19:24:25 +0200. 3 | 4 | 5 | Upstream Author: 6 | 7 | Radovan Garabík 8 | 9 | Copyright: 10 | 11 | Copyright © 2014 Radovan Garabík 12 | 13 | 14 | The original source can be found at: 15 | http://kassiopeia.juls.savba.sk/~garabik/software/grc.html 16 | 17 | It is released under GPL v2 or any later version, under Debian 18 | systems see /usr/share/common-licenses/GPL-2, 19 | and I have nothing against adding following additional condition (this is 20 | however not the part of the license, which remains GPL v2 or any later 21 | version): 22 | 23 | If you want to use, redistribute, modify, abuse and molest grc in any 24 | way, and you feel like it, you may add any clause to the license, as 25 | long as it does not put any additional responsibility for behaviour of 26 | this program at me and at least one of these conditions is met: 27 | 28 | - the resulting license fulfills Debian free software guidelines 29 | (http://www.debian.org/social_contract#guidelines) 30 | - Richard Stallman has nothing against the new license, neither 31 | against running grc with any version of python available 32 | at the time of adding the clause 33 | - the resulting license brings peace and happiness to the world 34 | -------------------------------------------------------------------------------- /debian/dirs: -------------------------------------------------------------------------------- 1 | usr/bin 2 | usr/share/grc 3 | -------------------------------------------------------------------------------- /debian/docs: -------------------------------------------------------------------------------- 1 | TODO README.markdown Regexp.txt CREDITS contrib/ 2 | -------------------------------------------------------------------------------- /debian/grc.default: -------------------------------------------------------------------------------- 1 | # add colourifying aliases for sh and bash shells 2 | # true or false 3 | # 4 | # since this is rather invasive, it defaults to false 5 | # 6 | # changing it makes your shell source /etc/profile.d/grc 7 | 8 | GRC_ALIASES=false 9 | 10 | -------------------------------------------------------------------------------- /debian/rules: -------------------------------------------------------------------------------- 1 | #!/usr/bin/make -f 2 | # Sample debian/rules that uses debhelper. 3 | # GNU copyright 1997 to 1999 by Joey Hess. 4 | 5 | # Uncomment this to turn on verbose mode. 6 | #export DH_VERBOSE=1 7 | 8 | clean: 9 | dh_testdir 10 | dh_testroot 11 | rm -f build-stamp 12 | dh_clean 13 | 14 | install: 15 | dh_testdir 16 | dh_testroot 17 | dh_prep 18 | dh_installdirs 19 | 20 | # Add here commands to install the package into debian/tmp. 21 | ./install.sh `pwd`/debian/grc/usr `pwd`/debian/grc 22 | 23 | build: build-arch build-indep 24 | build-arch: build-stamp 25 | build-indep: build-stamp 26 | build-stamp: 27 | # nothing to do 28 | 29 | # Build architecture-dependent files here. 30 | binary-arch: install 31 | # nothing to do 32 | 33 | # Build architecture-independent files here. 34 | binary-indep: build install 35 | # dh_testversion 36 | dh_testdir 37 | dh_testroot 38 | # dh_installdebconf 39 | dh_installdocs 40 | # dh_installexamples 41 | # dh_installmenu 42 | # dh_installemacsen 43 | # dh_installpam 44 | dh_installinit 45 | # dh_installcron 46 | dh_installman grc.1 grcat.1 47 | # dh_installinfo 48 | # dh_undocumented 49 | dh_installchangelogs 50 | dh_link 51 | # dh_strip 52 | dh_compress 53 | dh_fixperms 54 | # You may want to make some executables suid here. 55 | # dh_suidregister 56 | # dh_makeshlibs 57 | dh_installdeb 58 | # dh_perl 59 | dh_python3 60 | dh_shlibdeps 61 | dh_gencontrol 62 | dh_md5sums 63 | dh_builddeb 64 | 65 | binary: binary-indep binary-arch 66 | .PHONY: build clean binary-indep binary-arch binary install 67 | -------------------------------------------------------------------------------- /debian/source/format: -------------------------------------------------------------------------------- 1 | 3.0 (quilt) 2 | -------------------------------------------------------------------------------- /grc: -------------------------------------------------------------------------------- 1 | #! /usr/bin/env python3 2 | 3 | from __future__ import print_function 4 | 5 | import os, re, string, sys, getopt, signal 6 | 7 | 8 | def version(): 9 | print ("Generic Colouriser 1.13") 10 | sys.exit() 11 | 12 | def help(): 13 | print("""Generic Colouriser 1.13 14 | grc [options] command [args] 15 | Options: 16 | -e --stderr redirect stderr. If this option is selected, 17 | do not automatically redirect stdout 18 | -s --stdout redirect stdout, even if -e is selected 19 | -c name --config=name use name as configuration file for grcat 20 | --colour=word word is one of: on, off, auto 21 | --pty run command in pseudoterminal (experimental) 22 | """) 23 | sys.exit() 24 | 25 | 26 | def catch_signal(signum, frame): 27 | "catch signal sent to grc and forward it to the original application" 28 | global pidp 29 | try: 30 | os.kill(pidp, signum) 31 | except OSError: # if the subprocess already died 32 | pass 33 | 34 | try: 35 | optlist, args = getopt.getopt(sys.argv[1:], "sec:", ["stdout", "stderr", "config=", "colour=", "pty"] ) 36 | except: 37 | help() 38 | 39 | if not args: 40 | help() 41 | 42 | stdoutf = 0 43 | stderrf = 0 44 | 45 | # configure file for grcat 46 | cfile = "" 47 | 48 | colour = sys.stdout.isatty() 49 | use_pty = 0 50 | 51 | for i in optlist: 52 | if i[0] in ["--stderr", "-e"]: 53 | # redirect stderr 54 | stderrf = 1 55 | elif i[0] in ["--stdout", "-s"]: 56 | # redirect stdout 57 | stdoutf = 1 58 | elif i[0] in ["--config", "-c"]: 59 | cfile = i[1] 60 | elif i[0] == "--colour": 61 | if i[1] == "on": 62 | colour = 1 63 | elif i[1] == "off": 64 | colour = 0 65 | elif i[1] == "auto": 66 | colour = sys.stdout.isatty() 67 | else: 68 | help() 69 | elif i[0] == '--pty': 70 | use_pty = 1 71 | 72 | stdoutff = 1 73 | stderrff = 0 74 | if stderrf == 1: 75 | stdoutff = 0 76 | stderrff = 1 77 | if stdoutf == 1: 78 | stdoutff = 1 79 | 80 | if use_pty: 81 | import pty 82 | 83 | if cfile == "": 84 | home = os.environ.get('HOME') 85 | xdg = os.environ.get('XDG_CONFIG_HOME') 86 | if not xdg and home: 87 | xdg = home + '/.config' 88 | 89 | conffilenames = ['/etc/grc.conf', '/usr/local/etc/grc.conf'] 90 | if xdg: 91 | conffilenames += [xdg + '/grc/grc.conf'] 92 | if home: 93 | conffilenames += [home + '/.grc/grc.conf'] 94 | 95 | for conffile in conffilenames: 96 | # test if conffile exists, it can be also a pipe 97 | if os.path.exists(conffile) and not os.path.isdir(conffile): 98 | f = open(conffile, "r") 99 | while 1: 100 | l = f.readline() 101 | if l == "": 102 | break 103 | if l[0] == "#" or l[0] == '\012': 104 | continue 105 | regexp = l.strip() 106 | if re.search(regexp, ' '.join(args)): 107 | cfile = f.readline().strip() 108 | break 109 | 110 | 111 | signal.signal(signal.SIGINT, catch_signal) 112 | 113 | 114 | if cfile != "" and colour: 115 | if stdoutff: 116 | choo, chio = os.pipe() 117 | if stderrff: 118 | choe, chie = os.pipe() 119 | if use_pty: 120 | pidp, pty_fd = pty.fork() 121 | else: 122 | pidp = os.fork() 123 | if pidp == 0: # child, command to run 124 | if stdoutff: 125 | # connect child (this) stdout to pipe write end 126 | if not use_pty: 127 | os.dup2(chio, 1) 128 | os.close(choo) 129 | os.close(chio) 130 | if stderrff: 131 | os.dup2(chie, 2) 132 | os.close(choe) 133 | os.close(chie) 134 | try: 135 | os.execvp(args[0], args) 136 | except OSError as e: 137 | sys.stderr.write('grc: %s: %s\n' % (args[0], e.strerror)) 138 | sys.exit(1) 139 | 140 | 141 | if stdoutff: 142 | pido = os.fork() 143 | if pido == 0: # child, grcat 144 | # connect grcat's stdin to pipe read end, or pty master 145 | if use_pty: 146 | os.dup2(pty_fd, 0) 147 | else: 148 | os.dup2(choo, 0) 149 | os.close(choo) 150 | os.close(chio) 151 | if stderrff: 152 | os.close(choe) 153 | os.close(chie) 154 | os.execvp("grcat", ["grcat", cfile]) 155 | 156 | if stderrff: 157 | pide = os.fork() 158 | if pide == 0: # child 159 | os.dup2(choe, 0) 160 | os.dup2(2, 1) 161 | os.close(choe) 162 | os.close(chie) 163 | if stdoutff: 164 | os.close(choo) 165 | os.close(chio) 166 | os.execvp("grcat", ["grcat", cfile]) 167 | try: 168 | status = os.waitpid(pidp, 0)[1] 169 | except OSError: # interrupted system call 170 | status = None 171 | pass # this is probably not correct 172 | # except KeyboardInterrupt: # catching SIGINT does not work when using pty... 173 | # status = None 174 | # os.kill(pidp, signal.SIGINT) 175 | # pass 176 | if stderrff: 177 | os.close(chie) 178 | os.waitpid(pide, 0) 179 | os.close(choe) 180 | if stdoutff: 181 | os.close(chio) 182 | os.waitpid(pido, 0) 183 | os.close(choo) 184 | sys.exit(status and os.WEXITSTATUS(status)) 185 | 186 | else: 187 | pidp = os.fork() 188 | if pidp == 0: 189 | try: 190 | os.execvp(args[0], args) 191 | except OSError as e: 192 | sys.stderr.write('grc: %s: %s\n' % (args[0], e.strerror)) 193 | sys.exit(1) 194 | try: 195 | status = os.wait()[1] 196 | except OSError: # interrupted system call 197 | status = None 198 | pass # this is probably not correct 199 | 200 | sys.exit(status and os.WEXITSTATUS(status)) 201 | 202 | -------------------------------------------------------------------------------- /grc.1: -------------------------------------------------------------------------------- 1 | .TH GRC 1 2 | .SH NAME 3 | grc \- frontend for generic colouriser 4 | .BR grcat "(1) 5 | .SH SYNOPSIS 6 | .B grc 7 | .I [options] "command [args]" 8 | .SH DESCRIPTION 9 | .BR grc 10 | will execute command 11 | .I "command" 12 | with optional parameters 13 | .I "[args]" 14 | piping its stdout or stderr into 15 | .BR grcat ", 16 | with appropriate configuration file. 17 | 18 | Configuration file for 19 | .BR grc 20 | is determined by /etc/grc.conf file. 21 | 22 | Format of /etc/grc.conf: 23 | each entry consists of 2 lines, between entries there can be any number of empty 24 | lines or lines beginning with # (comments) 25 | 26 | First line is regular expression, second line the name of configuration 27 | file for 28 | .BR grcat ". 29 | 30 | Configuration file after the first regular expression matching 31 | .I "command [args]" 32 | will be passed to 33 | .BR grcat 34 | as its configuration file 35 | 36 | .SH OPTIONS 37 | .TP 38 | .B \-\-help 39 | Show summary of options. 40 | .TP 41 | .B \-\-version 42 | Display version. 43 | .TP 44 | .B \-e \-\-stderr 45 | Redirect error output. Unless 46 | .B -s 47 | is selected as well, this cancels redirection of standard output via 48 | .BR grcat 49 | .TP 50 | .B \-s \-\-stdout 51 | Redirect standard output. Used to redirect standard output 52 | together with 53 | .B \-\-stderr 54 | option. 55 | .TP 56 | .B \-\-colour=x 57 | x is one of 58 | .I on 59 | .I off 60 | .I auto 61 | 62 | .B \-\-colour=on 63 | will colourise (default) 64 | 65 | .B \-\-colour=off 66 | will just execute 67 | .I command 68 | without colourising. 69 | 70 | .B \-\-colour=auto 71 | will test if standard output is a tty, and colourise only when it is. 72 | 73 | .SH SEE ALSO 74 | .BR grcat "(1) 75 | .SH AUTHOR 76 | Written by Radovan Garab\('ik 77 | -------------------------------------------------------------------------------- /grc.conf: -------------------------------------------------------------------------------- 1 | # configure command 2 | ^([/\w\.]+\/)?configure\b 3 | conf.configure 4 | 5 | # ping command 6 | ^([/\w\.]+\/)?(io|o|n|h|arp|l2)?ping[236]?\b 7 | conf.ping 8 | 9 | # traceroute command 10 | ^([/\w\.]+\/)?traceroute6?\b 11 | conf.traceroute 12 | 13 | # gcc command 14 | ^([/\w\.]+\/)?(g?cc|[gc]\+\+)\s 15 | conf.gcc 16 | 17 | # make command 18 | ^([/\w\.]+\/)?g?make\b 19 | conf.gcc 20 | 21 | # netstat command 22 | ^([/\w\.]+\/)?netstat\b 23 | conf.netstat 24 | 25 | # stat command 26 | ^([/\w\.]+\/)?stat\b 27 | conf.stat 28 | 29 | # ss command 30 | ^([/\w\.]+\/)?ss\b 31 | conf.ss 32 | 33 | # diff command 34 | ^([/\w\.]+\/)?diff\b 35 | conf.diff 36 | 37 | # wdiff command 38 | ^([/\w\.]+\/)?wdiff\b 39 | conf.wdiff 40 | 41 | # last/who command 42 | ^([/\w\.]+\/)?(lastb?|who|lastlog)\b 43 | conf.last 44 | 45 | # ldap tools 46 | ^([/\w\.]+\/)?ldap\b 47 | conf.ldap 48 | 49 | # cvs command 50 | ^([/\w\.]+\/)?cvs\b 51 | conf.cvs 52 | 53 | # mount command 54 | ^([/\w\.]+\/)?mount\b 55 | conf.mount 56 | 57 | # findmnt command 58 | ^([/\w\.]+\/)?findmnt\b 59 | conf.findmnt 60 | 61 | # mtr command 62 | ^([/\w\.]+\/)?mtr\b 63 | conf.mtr 64 | 65 | # ps command 66 | ^([/\w\.]+\/)?ps\b 67 | conf.ps 68 | 69 | # dig command 70 | ^([/\w\.]+\/)?dig\b 71 | conf.dig 72 | 73 | # ifconfig command 74 | ^([/\w\.]+\/)?ifconfig\b 75 | conf.ifconfig 76 | 77 | # ls command 78 | ^([/\w\.]+\/)?ls\s 79 | conf.ls 80 | 81 | # mount 82 | ^([/\w\.]+\/)?mount\b 83 | conf.mount 84 | 85 | # df 86 | ^([/\w\.]+\/)?df\b 87 | conf.df 88 | 89 | # du 90 | ^([/\w\.]+\/)?du\b 91 | conf.du 92 | 93 | # ip addr/link 94 | ^([/\w\.]+\/)?ip( -\w+)* a(d(d(r(e(ss?)?)?)?)?)?\b 95 | conf.ipaddr 96 | 97 | ^([/\w\.]+\/)?ip( -\w+)* l(i(nk?)?)?\b 98 | conf.ipaddr 99 | 100 | # ip route 101 | ^([/\w\.]+\/)?ip( -\w+)* r(o(u(te?)?)?)?\b 102 | conf.iproute 103 | 104 | # ip neighbor 105 | ^([/\w\.]+\/)?ip( -\w+)* n(e(i(g(h(b(o(ur?)?)?)?)?)?)?)?\b 106 | conf.ipneighbor 107 | 108 | # ip command - rest of commands 109 | ^([/\w\.]+\/)?ip\b 110 | conf.ip 111 | 112 | # env 113 | ^([/\w\.]+\/)?env\b 114 | conf.env 115 | 116 | # systemctl show 117 | ^([/\w\.]+\/)?systemctl show\b 118 | conf.env 119 | 120 | # iptables 121 | ^([/\w\.]+\/)?iptables\b 122 | conf.iptables 123 | 124 | # lspci 125 | ^([/\w\.]+\/)?lspci\b 126 | conf.lspci 127 | 128 | # lsblk 129 | ^([/\w\.]+\/)?lsblk\b 130 | conf.lsblk 131 | 132 | # lsof 133 | ^([/\w\.]+\/)?lsof\b 134 | conf.lsof 135 | 136 | # blkid 137 | ^([/\w\.]+\/)?blkid\b 138 | conf.blkid 139 | 140 | # id 141 | ^([/\w\.]+\/)?id\b 142 | conf.id 143 | 144 | # iostat / sar 145 | ^([/\w\.]+\/)?(iostat|sar)\b 146 | conf.iostat_sar 147 | 148 | # fdisk 149 | ^([/\w\.]+\/)?fdisk -l\b 150 | conf.fdisk 151 | 152 | # free 153 | ^([/\w\.]+\/)?free\b 154 | conf.free 155 | 156 | ------------ 157 | # docker 158 | 159 | # docker ps 160 | ^([/\w\.]+\/)?docker(-compose)? ps\b 161 | conf.dockerps 162 | 163 | ^([/\w\.]+\/)?docker image(s| ls| list)\b 164 | conf.dockerimages 165 | 166 | ^([/\w\.]+\/)?docker search\b 167 | conf.dockersearch 168 | 169 | #^([/\w\.]+\/)?docker pull\b 170 | #conf.dockerpull 171 | 172 | ^([/\w\.]+\/)?docker-machine ls\b 173 | conf.docker-machinels 174 | 175 | ^([/\w\.]+\/)?docker network ls\b 176 | conf.dockernetwork 177 | 178 | ^([/\w\.]+\/)?docker info\b 179 | conf.dockerinfo 180 | 181 | ^([/\w\.]+\/)?docker version\b 182 | conf.dockerversion 183 | ------------ 184 | 185 | # journalctl command 186 | ^([/\w\.]+\/)?journalctl\b 187 | conf.log 188 | 189 | # KubeCTL 190 | ^([/\w\.]+\/)?kubectl((?!edit|exec|run|go-template).)*$ 191 | conf.kubectl 192 | 193 | # sensors command 194 | ^([/\w\.]+\/)?sensors\b 195 | conf.sensors 196 | 197 | # systemctl command 198 | ^([/\w\.]+\/)?systemctl\b 199 | conf.systemctl 200 | 201 | # sysctl command 202 | ^([/\w\.]+\/)?sysctl\b 203 | conf.sysctl 204 | 205 | # tcpdump command 206 | ^([/\w\.]+\/)?tcpdump\b 207 | conf.tcpdump 208 | 209 | # tune2fs command 210 | ^([/\w\.]+\/)?tune2fs\b 211 | conf.tune2fs 212 | 213 | # lsmod 214 | ^([/\w\.]+\/)?lsmod\b 215 | conf.lsmod 216 | 217 | # lsattr 218 | ^([/\w\.]+\/)?lsattr\b 219 | conf.lsattr 220 | 221 | # semanage --------------------------------- 222 | ^([/\w\.]+\/)?semanage boolean\b 223 | conf.semanageboolean 224 | ^([/\w\.]+\/)?semanage fcontext\b 225 | conf.semanagefcontext 226 | ^([/\w\.]+\/)?semanage (user|login|port)\b 227 | conf.semanageuser 228 | 229 | # getsebool 230 | ^([/\w\.]+\/)?getsebool\b 231 | conf.getsebool 232 | 233 | # ulimit 234 | ^([/\w\.]+\/)?ulimit\b 235 | conf.ulimit 236 | 237 | # vmstat 238 | ^([/\w\.]+\/)?vmstat\b 239 | conf.vmstat 240 | 241 | # dnf 242 | ^([/\w\.]+\/)?dnf\b 243 | conf.dnf 244 | 245 | # nmap 246 | ^([/\w\.]+\/)?nmap\b 247 | conf.nmap 248 | 249 | # uptime | w 250 | ^([/\w\.]+\/)?(uptime|w)\b 251 | conf.uptime 252 | 253 | # getfacl 254 | ^([/\w\.]+\/)?getfacl\b 255 | conf.getfacl 256 | 257 | # ntpdate 258 | ^([/\w\.]+\/)?ntpdate\b 259 | conf.ntpdate 260 | 261 | # showmount 262 | ^([/\w\.]+\/)?showmount\b 263 | conf.showmount 264 | 265 | # apache ant command 266 | ^([/\w\.]+\/)?ant\b 267 | conf.ant 268 | 269 | # # apache maven command 270 | ^([/\w\.]+\/)?mvn\b 271 | conf.mvn 272 | 273 | # iwconfig command 274 | ^([/\w\.]+\/)?iwconfig\b 275 | conf.iwconfig 276 | 277 | # lolcat command 278 | ^([/\w\.]+\/)?lolcat\b 279 | conf.lolcat 280 | 281 | # whois 282 | ^([/\w\.]+\/)?whois\b 283 | conf.whois 284 | 285 | # go test 286 | ^([/\w\.]+\/)?go test\b 287 | conf.go-test 288 | 289 | # sockstat command 290 | ^([/\w\.]+\/)?sockstat\b 291 | conf.sockstat 292 | 293 | # anything to do with irc 294 | \b\w+\b.*irc.* 295 | conf.irclog 296 | 297 | # log file 298 | \b\w+\b.*log\b 299 | conf.log 300 | 301 | 302 | -------------------------------------------------------------------------------- /grc.fish: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env fish 2 | # 3 | # To load in ~/.config/fish/fish.conf or a new file in 4 | # ~/.config/fish/conf.d add: 5 | # source /etc/grc.fish (path may depend on install method) 6 | # 7 | # See also the plugin at https://github.com/oh-my-fish/plugin-grc 8 | 9 | set -U grc_plugin_execs cat cvs df diff dig gcc g++ ls ifconfig \ 10 | make mount mtr netstat ping ps tail traceroute \ 11 | wdiff blkid du dnf docker docker-compose docker-machine env id ip iostat journalctl kubectl \ 12 | last lsattr lsblk lspci lsmod lsof getfacl getsebool ulimit uptime nmap \ 13 | fdisk findmnt free semanage sar ss sysctl systemctl stat showmount \ 14 | tcpdump tune2fs vmstat w who sockstat 15 | 16 | for executable in $grc_plugin_execs 17 | if type -q $executable 18 | function $executable --inherit-variable executable --wraps=$executable 19 | if isatty 1 20 | grc $executable $argv 21 | else 22 | eval command $executable $argv 23 | end 24 | end 25 | end 26 | end 27 | -------------------------------------------------------------------------------- /grc.sh: -------------------------------------------------------------------------------- 1 | # aliases for grc(1) 2 | 3 | # this will execute only if there is a line with 4 | # GRC_ALIASES=true 5 | # in /etc/default/grc or you export GRC_ALIASES=true prior to sourcing this 6 | 7 | [ -f /etc/default/grc ] && . /etc/default/grc 8 | 9 | [ x$GRC_ALIASES = xtrue ] || return 0 10 | 11 | GRC="$(which grc)" 12 | if tty -s && [ -n "$TERM" ] && [ "$TERM" != dumb ] && [ -n "$GRC" ]; then 13 | alias colourify="$GRC -es" 14 | alias blkid='colourify blkid' 15 | alias configure='colourify ./configure' 16 | alias df='colourify df' 17 | alias diff='colourify diff' 18 | alias docker='colourify docker' 19 | alias docker-compose='colourify docker-compose' 20 | alias docker-machine='colourify docker-machine' 21 | alias du='colourify du' 22 | # alias env='colourify env' 23 | alias free='colourify free' 24 | alias fdisk='colourify fdisk' 25 | alias findmnt='colourify findmnt' 26 | alias make='colourify make' 27 | alias gcc='colourify gcc' 28 | alias g++='colourify g++' 29 | alias id='colourify id' 30 | alias ip='colourify ip' 31 | alias iptables='colourify iptables' 32 | alias as='colourify as' 33 | alias gas='colourify gas' 34 | alias journalctl='colourify journalctl' 35 | alias kubectl='colourify kubectl' 36 | alias ld='colourify ld' 37 | #alias ls='colourify ls' 38 | alias lsof='colourify lsof' 39 | alias lsblk='colourify lsblk' 40 | alias lspci='colourify lspci' 41 | alias netstat='colourify netstat' 42 | alias ping='colourify ping' 43 | alias ss='colourify ss' 44 | alias traceroute='colourify traceroute' 45 | alias traceroute6='colourify traceroute6' 46 | alias head='colourify head' 47 | alias tail='colourify tail' 48 | alias dig='colourify dig' 49 | alias mount='colourify mount' 50 | alias ps='colourify ps' 51 | alias mtr='colourify mtr' 52 | alias semanage='colourify semanage' 53 | alias getsebool='colourify getsebool' 54 | alias ifconfig='colourify ifconfig' 55 | alias sockstat='colourify sockstat' 56 | fi 57 | 58 | -------------------------------------------------------------------------------- /grc.spec: -------------------------------------------------------------------------------- 1 | # Note that this is NOT a relocatable package 2 | %define ver 1.0.8 3 | %define rel 1 4 | %define prefix /usr 5 | %define confdir /etc 6 | 7 | Summary: Generic Colouriser 8 | Name: grc 9 | Version: %ver 10 | Release: %rel 11 | License: GPL 12 | Group: Development/Tools 13 | Source: grc-%{PACKAGE_VERSION}.tar.gz 14 | URL: http://melkor.dnp.fmph.uniba.sk/~garabik/grc.html 15 | BuildRoot: %{_tmppath}/grc-%{PACKAGE_VERSION}-root 16 | Packager: Valerij Klein 17 | BuildArchitectures: noarch 18 | 19 | %description 20 | Generic Colouriser is yet another colouriser for beautifying your logfiles 21 | or output of commands. 22 | 23 | Authors: 24 | -------- 25 | Radovan Garabik 26 | 27 | %prep 28 | %setup 29 | 30 | %install 31 | rm -rf $RPM_BUILD_ROOT 32 | 33 | install -d -m 755 $RPM_BUILD_ROOT%{prefix}/bin 34 | install -m 755 grc $RPM_BUILD_ROOT%{prefix}/bin 35 | install -m 755 grcat $RPM_BUILD_ROOT%{prefix}/bin 36 | install -d -m 755 $RPM_BUILD_ROOT%{prefix}/share/grc 37 | install -m 644 colorfiles/conf.* $RPM_BUILD_ROOT%{prefix}/share/grc 38 | install -d -m 755 $RPM_BUILD_ROOT%{confdir} 39 | install -m 644 grc.conf $RPM_BUILD_ROOT%{confdir} 40 | install -d -m 755 $RPM_BUILD_ROOT%{_mandir}/man1 41 | install -m 644 *.1 $RPM_BUILD_ROOT%{_mandir}/man1 42 | 43 | %clean 44 | rm -rf $RPM_BUILD_ROOT 45 | 46 | %files 47 | %defattr(-, root, root) 48 | 49 | %doc CHANGES CREDITS README TODO Regexp.txt 50 | %{prefix}/bin/* 51 | %{prefix}/share/grc/* 52 | %doc %{_mandir}/man1/* 53 | %config(noreplace) /etc/grc.conf 54 | 55 | %changelog 56 | * Fri Sep 01 2006 Valerij Klein 1.0.7-1 57 | - Minor changes in SPEC 58 | -------------------------------------------------------------------------------- /grc.spec.old: -------------------------------------------------------------------------------- 1 | # Note that this is NOT a relocatable package 2 | %define ver 1.0 3 | %define rel 1 4 | %define prefix /usr 5 | %define confdir /etc 6 | 7 | Summary: Generic Colouriser 8 | Name: grc 9 | Version: %ver 10 | Release: %rel 11 | Copyright: GPL 12 | Group: Console/Utilities 13 | Source: grc_%{PACKAGE_VERSION}.tar.gz 14 | URL: http://melkor.dnp.fmph.uniba.sk/~garabik/grc.html 15 | BuildRoot: %{_tmppath}/grc-%{PACKAGE_VERSION}-root 16 | Packager: Christian Zuckschwerdt 17 | 18 | %description 19 | Generic Colouriser is yet another colouriser for beautifying your logfiles 20 | or output of commands. 21 | 22 | Authors: 23 | -------- 24 | Radovan Garabik 25 | 26 | %prep 27 | %setup 28 | 29 | %install 30 | rm -rf $RPM_BUILD_ROOT 31 | 32 | install -d -m 755 $RPM_BUILD_ROOT%{prefix}/bin 33 | install -m 755 grc $RPM_BUILD_ROOT%{prefix}/bin 34 | install -m 755 grcat $RPM_BUILD_ROOT%{prefix}/bin 35 | install -d -m 755 $RPM_BUILD_ROOT%{prefix}/share/grc 36 | install -m 644 conf.* $RPM_BUILD_ROOT%{prefix}/share/grc 37 | install -d -m 755 $RPM_BUILD_ROOT%{confdir} 38 | install -m 755 grc.conf $RPM_BUILD_ROOT%{confdir} 39 | install -d -m 755 $RPM_BUILD_ROOT%{_mandir}/man1 40 | install -m 644 *.1 $RPM_BUILD_ROOT%{_mandir}/man1 41 | 42 | %clean 43 | rm -rf $RPM_BUILD_ROOT 44 | 45 | %files 46 | %defattr(-, root, root) 47 | 48 | %doc CHANGES CREDITS README TODO Regexp.txt 49 | %{prefix}/bin/* 50 | %{prefix}/share/grc/* 51 | %doc %{_mandir}/man1/* 52 | %config /etc/* 53 | -------------------------------------------------------------------------------- /grc.zsh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env zsh 2 | 3 | if ! tty -s || [ ! -n "$TERM" ] || [ "$TERM" = dumb ] || (( ! $+commands[grc] )) 4 | then 5 | return 6 | fi 7 | 8 | # Supported commands 9 | cmds=( 10 | as 11 | ant 12 | blkid 13 | cc 14 | configure 15 | curl 16 | cvs 17 | df 18 | diff 19 | dig 20 | dnf 21 | docker 22 | docker-compose 23 | docker-machine 24 | du 25 | env 26 | fdisk 27 | findmnt 28 | free 29 | g++ 30 | gas 31 | gcc 32 | getfacl 33 | getsebool 34 | gmake 35 | id 36 | ifconfig 37 | iostat 38 | ip 39 | iptables 40 | iwconfig 41 | journalctl 42 | kubectl 43 | last 44 | ldap 45 | lolcat 46 | ld 47 | ls 48 | lsattr 49 | lsblk 50 | lsmod 51 | lsof 52 | lspci 53 | make 54 | mount 55 | mtr 56 | mvn 57 | netstat 58 | nmap 59 | ntpdate 60 | php 61 | ping 62 | ping6 63 | proftpd 64 | ps 65 | sar 66 | semanage 67 | sensors 68 | showmount 69 | sockstat 70 | ss 71 | stat 72 | sysctl 73 | systemctl 74 | tcpdump 75 | traceroute 76 | traceroute6 77 | tune2fs 78 | ulimit 79 | uptime 80 | vmstat 81 | wdiff 82 | whois 83 | ) 84 | 85 | # Set alias for available commands. 86 | for cmd in $cmds ; do 87 | if (( $+commands[$cmd] )) ; then 88 | $cmd() { 89 | grc --colour=auto ${commands[$0]} "$@" 90 | } 91 | fi 92 | done 93 | 94 | # Clean up variables 95 | unset cmds cmd 96 | -------------------------------------------------------------------------------- /grcat: -------------------------------------------------------------------------------- 1 | #! /usr/bin/env python3 2 | 3 | from __future__ import print_function 4 | 5 | import sys, os, string, re, signal, errno 6 | 7 | 8 | # redefine readline to pass invalidly encoded characters unchanged, if possible 9 | if hasattr(sys.stdin, 'reconfigure') and hasattr(sys.stdout, 'reconfigure'): 10 | # at least python3.7 11 | sys.stdin.reconfigure(errors='surrogateescape') 12 | sys.stdout.reconfigure(errors='surrogateescape') 13 | myreadline = sys.stdin.readline 14 | myprint = print 15 | else: 16 | if hasattr(sys.stdin, 'buffer'): 17 | # python3 18 | buffer_reader = sys.stdin.buffer 19 | else: 20 | buffer_reader = sys.stdin 21 | def myreadline(): 22 | for line in buffer_reader: 23 | try: 24 | decoded = line.decode('utf-8', errors='surrogateescape') 25 | except (UnicodeDecodeError, LookupError): 26 | decoded = line.decode('utf-8', errors='ignore') 27 | return decoded 28 | return '' 29 | def myprint(x): 30 | try: 31 | print(x) 32 | except UnicodeEncodeError: 33 | print(x.encode('utf-8', errors='replace').decode('utf-8')) 34 | 35 | #some default definitions 36 | colours = { 37 | 'none' : "", 38 | 'default' : "\033[0m", 39 | 'bold' : "\033[1m", 40 | 'underline' : "\033[4m", 41 | 'blink' : "\033[5m", 42 | 'reverse' : "\033[7m", 43 | 'concealed' : "\033[8m", 44 | 45 | 'black' : "\033[30m", 46 | 'red' : "\033[31m", 47 | 'green' : "\033[32m", 48 | 'yellow' : "\033[33m", 49 | 'blue' : "\033[34m", 50 | 'magenta' : "\033[35m", 51 | 'cyan' : "\033[36m", 52 | 'white' : "\033[37m", 53 | 54 | 'on_black' : "\033[40m", 55 | 'on_red' : "\033[41m", 56 | 'on_green' : "\033[42m", 57 | 'on_yellow' : "\033[43m", 58 | 'on_blue' : "\033[44m", 59 | 'on_magenta' : "\033[45m", 60 | 'on_cyan' : "\033[46m", 61 | 'on_white' : "\033[47m", 62 | 63 | 'beep' : "\007", 64 | 'previous' : "prev", 65 | 'unchanged' : "unchanged", 66 | 67 | # non-standard attributes, supported by some terminals 68 | 'dark' : "\033[2m", 69 | 'italic' : "\033[3m", 70 | 'rapidblink' : "\033[6m", 71 | 'strikethrough': "\033[9m", 72 | 73 | # aixterm bright color codes 74 | # prefixed with standard ANSI codes for graceful failure 75 | 'bright_black' : "\033[30;90m", 76 | 'bright_red' : "\033[31;91m", 77 | 'bright_green' : "\033[32;92m", 78 | 'bright_yellow' : "\033[33;93m", 79 | 'bright_blue' : "\033[34;94m", 80 | 'bright_magenta' : "\033[35;95m", 81 | 'bright_cyan' : "\033[36;96m", 82 | 'bright_white' : "\033[37;97m", 83 | 84 | 'on_bright_black' : "\033[40;100m", 85 | 'on_bright_red' : "\033[41;101m", 86 | 'on_bright_green' : "\033[42;102m", 87 | 'on_bright_yellow' : "\033[43;103m", 88 | 'on_bright_blue' : "\033[44;104m", 89 | 'on_bright_magenta' : "\033[45;105m", 90 | 'on_bright_cyan' : "\033[46;106m", 91 | 'on_bright_white' : "\033[47;107m", 92 | } 93 | 94 | 95 | # ignore ctrl C - this is not ideal for standalone grcat, but 96 | # enables propagating SIGINT to the other subprocess in grc 97 | signal.signal(signal.SIGINT, signal.SIG_IGN) 98 | 99 | def add2list(clist, m, patterncolour): 100 | for group in range(0, len(m.groups()) +1): 101 | if group < len(patterncolour): 102 | clist.append((m.start(group), m.end(group), patterncolour[group])) 103 | else: 104 | clist.append((m.start(group), m.end(group), patterncolour[0])) 105 | 106 | def get_colour(x): 107 | if x in colours: 108 | return colours[x] 109 | elif len(x)>=2 and x[0]=='"' and x[-1]=='"': 110 | return eval(x) 111 | else: 112 | raise ValueError('Bad colour specified: '+x) 113 | 114 | 115 | home = [] 116 | conffile = None 117 | xdg_config = os.environ.get('XDG_CONFIG_HOME') 118 | xdg_data = os.environ.get('XDG_DATA_HOME') 119 | home = os.environ.get('HOME') 120 | if home and not xdg_config: 121 | xdg_config = home + '/.config' 122 | if home and not xdg_data: 123 | xdg_data = home + '/.local/share' 124 | 125 | conffilepath = [""] 126 | if xdg_data: 127 | conffilepath += [xdg_data + '/grc/'] 128 | if xdg_config: 129 | conffilepath += [xdg_config + '/grc/'] 130 | if home: 131 | conffilepath += [home + '/.grc/'] 132 | conffilepath += ['/usr/local/share/grc/', '/usr/share/grc/'] 133 | if len(sys.argv) != 2: 134 | sys.stderr.write("You are not supposed to call grcat directly, but the usage is: grcat conffile\n") 135 | sys.exit(1) 136 | 137 | conffile_arg = sys.argv[1] # tentative conffile 138 | for i in conffilepath: 139 | # test if conffile exists, it can be also a pipe 140 | if os.path.exists(i+conffile_arg) and not os.path.isdir(i+conffile_arg): 141 | conffile = i+conffile_arg 142 | break 143 | 144 | if not conffile: 145 | sys.stderr.write("config file [%s] not found\n" % sys.argv[1]) 146 | sys.exit(1) 147 | 148 | regexplist = [] 149 | 150 | f = open(conffile, "r") 151 | is_last = 0 152 | split = str.split 153 | lower = str.lower 154 | letters = string.ascii_letters 155 | while not is_last: 156 | ll = {'count':"more"} 157 | while 1: 158 | l = f.readline() 159 | if l == "": 160 | is_last = 1 161 | break 162 | if l[0] == "#" or l[0] == '\012': 163 | continue 164 | if not l[0] in letters: 165 | break 166 | fields = split(l.rstrip('\r\n'), "=", 1) 167 | if len(fields) != 2: 168 | sys.stderr.write('Error in configuration, I expect keyword=value line\n') 169 | sys.stderr.write('But I got instead:\n') 170 | sys.stderr.write(repr(l)) 171 | sys.stderr.write('\n') 172 | sys.exit(1) 173 | keyword, value = fields 174 | keyword = lower(keyword) 175 | if keyword in ('colors', 'colour', 'color'): 176 | keyword = 'colours' 177 | if not keyword in ["regexp", "colours", "count", "command", "skip", "replace", "concat"]: 178 | raise ValueError("Invalid keyword") 179 | ll[keyword] = value 180 | 181 | # Split string into one string per regex group 182 | # e.g. split "brown bold, red" into "brown bold" and 183 | # "red" 184 | #colstrings = [] 185 | #for colgroup in split(ll['colours'], ','): 186 | # colourlist = split(colgroup) 187 | # c = "" 188 | # for i in colourlist : 189 | # c = c + colours[i] 190 | # colstrings.append(c) 191 | # do not try to understand the optimized form below :-) 192 | if 'colours' in ll: 193 | colstrings = list( 194 | [''.join([get_colour(x) for x in split(colgroup)]) for colgroup in split(ll['colours'], ',')] 195 | ) 196 | ll['colours'] = colstrings 197 | 198 | cs = ll['count'] 199 | if 'regexp' in ll: 200 | ll['regexp'] = re.compile(ll['regexp']).search 201 | regexplist.append(ll) 202 | 203 | prevcolour = colours['default'] 204 | prevcount = "more" 205 | blockflag = 0 206 | 207 | while 1: 208 | line = myreadline() 209 | if line == "" : 210 | break 211 | if line[-1] in '\r\n': 212 | line = line[:-1] 213 | clist = [] 214 | skip = 0 215 | for pattern in regexplist: 216 | pos = 0 217 | currcount = pattern['count'] 218 | was_replace = 0 # watch replacements, replace regexp only one per line, to avoid infinte loops if the replacement matches the regexp again 219 | while 1: 220 | m = pattern['regexp'](line, pos) 221 | if m: 222 | if 'replace' in pattern: 223 | if was_replace: 224 | break 225 | line = re.sub(m.re, pattern['replace'], line) 226 | was_replace = 1 227 | if 'colours' in pattern: 228 | if currcount == "block": 229 | blockflag = 1 230 | blockcolour = pattern['colours'][0] 231 | currcount = "stop" 232 | break 233 | elif currcount == "unblock": 234 | blockflag = 0 235 | blockcolour = colours['default'] 236 | currcount = "stop" 237 | add2list(clist, m, pattern['colours']) 238 | if currcount == "previous": 239 | currcount = prevcount 240 | if currcount == "stop": 241 | break 242 | if currcount == "more": 243 | prevcount = "more" 244 | newpos = m.end(0) 245 | # special case, if the regexp matched but did not consume anything, 246 | # advance the position by 1 to escape endless loop 247 | if newpos == pos: 248 | pos += 1 249 | else: 250 | pos = newpos 251 | else: 252 | prevcount = "once" 253 | pos = len(line) 254 | if 'concat' in pattern: 255 | with open(pattern['concat'], 'a') as f : 256 | f.write(line + '\n') 257 | if 'colours' not in pattern: 258 | break 259 | if 'command' in pattern: 260 | os.system(pattern['command']) 261 | if 'colours' not in pattern: 262 | break 263 | if 'skip' in pattern: 264 | skip = pattern['skip'] in ("yes", "1", "true") 265 | if 'colours' not in pattern: 266 | break 267 | else: 268 | break 269 | if m and currcount == "stop": 270 | prevcount = "stop" 271 | break 272 | if len(clist) == 0: 273 | prevcolour = colours['default'] 274 | first_char = 0 275 | last_char = 0 276 | length_line = len(line) 277 | if blockflag == 0: 278 | cline = (length_line+1)*[colours['default']] 279 | for i in clist: 280 | # each position in the string has its own colour 281 | if i[2] == "prev": 282 | cline[i[0]:i[1]] = [colours['default']+prevcolour]*(i[1]-i[0]) 283 | elif i[2] != "unchanged": 284 | cline[i[0]:i[1]] = [colours['default']+i[2]]*(i[1]-i[0]) 285 | if i[0] == 0: 286 | first_char = 1 287 | if i[2] != "prev": 288 | prevcolour = i[2] 289 | if i[1] == length_line: 290 | last_char = 1 291 | if first_char == 0 or last_char == 0: 292 | prevcolour = colours['default'] 293 | else: 294 | cline = (length_line+1)*[blockcolour] 295 | nline = "" 296 | clineprev = "" 297 | if not skip: 298 | for i in range(len(line)): 299 | if cline[i] == clineprev: 300 | nline = nline + line[i] 301 | else: 302 | nline = nline + cline[i] + line[i] 303 | clineprev = cline[i] 304 | nline = nline + colours['default'] 305 | try: 306 | myprint(nline) 307 | except IOError as e: 308 | if e.errno == errno.EPIPE: 309 | break 310 | else: 311 | raise 312 | 313 | -------------------------------------------------------------------------------- /grcat.1: -------------------------------------------------------------------------------- 1 | .TH GRCAT 1 2 | .SH NAME 3 | grcat \- read from standard input, colourise it and write to standard 4 | output 5 | .SH SYNOPSIS 6 | .B grcat 7 | .I "configuration" 8 | .SH DESCRIPTION 9 | .I "configuration" 10 | is a name of a configuration file. Directories 11 | ~/.grc/, /usr/local/share/grc/, /usr/share/grc/ 12 | are searched for the file (in this order). 13 | 14 | If the file is not found, it is assumed to be an absolute path of a 15 | configuration file located elsewhere. 16 | 17 | Configuration file consists of entries, one per regexp, entries are 18 | separated with lines with first character non-alphanumeric (except #). 19 | Lines beginning with # or empty lines are ignored. 20 | 21 | Each entry consists of several lines. 22 | Each line has form: 23 | .I keyword=value 24 | where keyword is one of: 25 | .BR regexp ", 26 | .BR colours ", 27 | .BR command ", 28 | .BR concat ", 29 | .BR skip ", 30 | .BR count ". 31 | Only 32 | .BR regexp 33 | is mandatory, but it does not have much sense by itself 34 | unless you specify at least a 35 | .BR colour 36 | or 37 | .BR command 38 | keyword as well. 39 | 40 | .I regexp 41 | is the regular expression to match 42 | 43 | .I colours 44 | is the list of colours, separated by commas (you can specify only 45 | one colour), each colour per one regexp group specified in regexp. 46 | 47 | .I command 48 | is command to be executed when regexp matches. Its output will 49 | be mixed with normal stdout, use redirectors ( >/dev/null) if you want 50 | to supress it. 51 | 52 | .I replace 53 | means the regular expression match will be replaced by the value, all the 54 | preceeding regular expressions will be evaluated against the original text, all 55 | the following regular expressions will be evaluated against the replaced text 56 | 57 | .I skip 58 | can be either 59 | .BR yes ", 60 | or 61 | .BR no ", 62 | if yes, the matched line will be skipped and not displayed in output. 63 | Default is no. 64 | 65 | .I count 66 | is one of words: 67 | .BR once ", 68 | .BR more ", 69 | or 70 | .BR stop ". 71 | 72 | .BR once 73 | means that if the regexp is matched, its first occurrence is coloured 74 | and the program will continue with other regexp's. 75 | 76 | .BR more 77 | means that if there are multiple matches of the regexp in one line, 78 | all of them will be coloured. 79 | 80 | .BR stop 81 | means that the regexp will be coloured and program will move to the 82 | next line (i.e. ignoring other regexp's) 83 | 84 | Regular expressions are evaluated from top to bottom, this allows nested 85 | and overlapped 86 | expressions. (e.g. you colour everything inside parentheses with one 87 | colour, and if a following expression matches the text inside parentheses, 88 | it will be also coloured) 89 | 90 | .SH OPTIONS 91 | None so far. 92 | .SH SEE ALSO 93 | .BR grc "(1) 94 | .SH AUTHOR 95 | Written by Radovan Garab\('ik 96 | -------------------------------------------------------------------------------- /install.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | set -e 4 | 5 | PREFIX=${1:-/usr/local} 6 | ETCPREFIX=$2 7 | 8 | 9 | BINDIR=$PREFIX/bin 10 | LIBDIR=$PREFIX/share/grc 11 | MANDIR=$PREFIX/share/man 12 | CONFDIR=$ETCPREFIX/etc 13 | PROFILEDIR=$CONFDIR/profile.d 14 | 15 | mkdir -p $BINDIR || true 16 | cp -fv grc grcat $BINDIR 17 | mkdir -p $LIBDIR || true 18 | cp -fv colourfiles/conf.* $LIBDIR 19 | mkdir -p $MANDIR/man1 20 | cp -fv grc.1 $MANDIR/man1 21 | cp -fv grcat.1 $MANDIR/man1 22 | mkdir -p $CONFDIR 23 | cp -fv grc.conf $CONFDIR 24 | cp -fv grc.zsh $CONFDIR 25 | cp -fv grc.fish $CONFDIR 26 | mkdir -p $PROFILEDIR 27 | cp -fv grc.sh $PROFILEDIR 28 | 29 | # probably we should not install it into site-functions in a debian package... 30 | if [ "$PREFIX" = "/usr/local" ]; then 31 | mkdir -p $PREFIX/zsh/site-functions 32 | cp -fv _grc $PREFIX/zsh/site-functions 33 | fi 34 | 35 | --------------------------------------------------------------------------------