Colour highlighting output based on regex in shell

There is an answer in superuser.com:

your-command | grep -E --color 'pattern|$'

or

your-command | grep --color 'pattern\|$'

This will “match your pattern or the end-of-line on each line. Only the pattern is highlighted…”

Leave a Comment