egregious use of color (uses 256-color term support):
function hl() {
local R='';
while [ $# -gt 0 ]; do
R="$R|$1";
shift;
done;
env GREP_COLORS="mt=38;5;$((RANDOM%256))" egrep --color=always $R;
}
then do e.g.
whatever pipeline | hl foo bar baz | hl quux | hl '^.* frob.*$' | less -R
results in foo/bar/baz highlighted in one color, quux in another, and whole lines containing frob in another. hopefully the colors aren't indistinguishable from each other or from the terminal background :\
I use a somewhat similar setup in emacs, where a key binding adds the word under point to a syntax highlighting table, but the color is computed as the first 6 characters of the md5sum of the word.
function hl() { local R=''; while [ $# -gt 0 ]; do R="$R|$1"; shift; done; env GREP_COLORS="mt=38;5;$((RANDOM%256))" egrep --color=always $R; }
then do e.g.
whatever pipeline | hl foo bar baz | hl quux | hl '^.* frob.*$' | less -R
results in foo/bar/baz highlighted in one color, quux in another, and whole lines containing frob in another. hopefully the colors aren't indistinguishable from each other or from the terminal background :\
I use a somewhat similar setup in emacs, where a key binding adds the word under point to a syntax highlighting table, but the color is computed as the first 6 characters of the md5sum of the word.