paperlined.org
apps
>
unix
document updated 12 years ago, on Oct 29, 2012
What tools are available for making arbitrary ANSI color hilights, based on user-specified regexps?
Generic Colourizer
(grc)
Term::Highlight
(command line interface:
hl
)
Text::Highlight
a one-liner:
function hil { perl -0777pe'BEGIN{$p=join"|",map{"($_)"}grep{++$i%2}@ARGV;@c=grep{$j++%2}@ARGV;@ARGV=()}s/$p/for($i=0;$i<@c&&!defined$-[$i+1];$i++){}"\e[$c[$i]m$+\e[0m"/gome' "$@"; }
See
here for full documentation
for this Bash function.