Ross Rogers

blog projects resume

hi terminal text highlighter

13 Feb 2014

Once you've grown dependent on seeing color in your code editor, it is hard to fathom the folks who still edit their code with no syntax highlighting at all. Finally, after alt-tab'ing from my favorite editor, jEdit, back to Konsole to look at verilog simulation log files for the 700th time in one day, I noticed that one had colors and the other didn't. I too was banging rocks together when it came to processing textual input.

And that's why I wrote a simple utility to inject colors into the linux terminal based on regexes called hi. This simple linux utility transforms text like

into

by piping the text through hi like

cat logfile | hi --hex_nums \
    ERROR RED NONE \
    '^ *\d+ ns \S* *:' BLACK NONE \
    injected BROWN NONE \
    sunk GREEN NONE | \
less -R

Check it out here at https://code.google.com/p/hi-terminal-text-highlighter/

Note This was one of my early C++ projects and does not represent my current level of quality in C++ code.