that's way better than my alternative which was a bash function:
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
}
thanks
The use case that drove its development was needing to keep track of UUIDs across multiple logs - and grep --color will colorize its matches, but not differentiate between ones that have different content. With this, I could watch both logs as data was passed from one to the other and keep track of e.g. the orange one.
I also thought it would be nice to be able to use patterns from logstash's grok, so I wrote grokpat[2] to find patterns for me. A lot of grok's patterns use atomic groups, which aren't available in Python 2, so I wrote redi[3] to convert them from grok's syntax to Python compatible syntax.
So I can now colorize logs easily as follows:
[1] https://github.com/cromo/synesthesia [2] https://github.com/cromo/grokpat [3] https://github.com/cromo/redi