Re: grep trick
Chris,
On Tue, 8 Apr 2008, Chris Bannister wrote:
In your .bashrc put:
export GREP_COLOR=33
alias grep='grep --colour=always'
Very cool tip!! In my case, however, my .cshrc file might be a better
choice since I don't use bash, and of course the syntax is different. As
someone else pointed out the above will break scripts that use grep. A
moment or two of Googling turned up another option. If one uses
--color=auto, it will colorize output going to a terminal but won't if the
output is piped to another command or redirected to a file. The downside
is that with --color=auto output piped to less -r doesn't get colorized.
I'm sure there's a creative way to keep from breaking existing scripts and
still be able to view colorized output via less.
You can always try different values of GREP_COLOR. Although I can't seem
to get yellow.
After another moment of Googling, for yellow, use:
setenv GREP_COLOR '1;33'
or your shell's equivalent.
Kevin
http://www.RawFedDogs.net
http://www.WacoAgilityGroup.org
Bruceville, TX
Si hoc legere scis nimium eruditionis habes.
Longum iter est per praecepta, breve et efficax per exempla!!!
Reply to:
- References:
- grep trick
- From: Chris Bannister <mockingbird@earthlight.co.nz>