Hgrep is a trivial, but cute, front-end for grep. It takes the results of the grep and highlights the word that was searched for.
It was originally written in 1988, and is now obsolete because
grep has the
However the grep man page doesn't realy explain how to use
that flag, so I'll document it here.
First, edit your .dotfiles and make shell aliases to add the
--color flag to your grep commands.
I like to have an alias for each different way of running grep,
even though they are mostly interchangable these days:
alias grep 'grep --color' alias egrep 'egrep --color' alias fgrep 'fgrep --color'
--color flag lets you control what color is
used via the
$GREP_COLOR environment variable.
This is the part that isn't documented - what goes into
By reading the code I determined that it just gets inserted into
an ANSI Select Graphic Rendition command.
The default is '1;31' which is bold red.
Other useful values:
So, decide what color or effect you want, and then set the environment variable in your .dotfiles:
export GREP_COLOR='value' # most shells setenv GREP_COLOR 'value' # csh
Next time you start up a shell you'll be all set up. Enjoy!
ACME Labs / Software / hgrep