Is there a method to colorize the output of cat
, the way grep
does.
For grep
, in most consoles it displays a colored output hi
pygmentize is good. I have an alias:
alias c='pygmentize -g'
but highlight is another widely available alternative is
alias cats='highlight -O ansi --force'
You may have to install pygments
using one of these:
sudo apt install python-pygments
sudo pip install pygments
sudo easy_install Pygments #for Mac user
and for highlight
package which is easily available on all distributions
sudo apt install highlight
sudo yum install highlight
I'm attaching shots for both down below for a good comparison in highlightings
Here is pygmentize
in action:
and this is highlight
: