Color in grep output to distinquish the matching entries

2010-02-04 118 words 1 min read

Most of the times I end up spending a lot of time to look for the string in the grep output when I do a search. This is quite frustrating and thus I looked at the options for grep command that would make my life easier and there definately is something. Here it is:

export GREP_COLOR=”5;36”

But for this to work you would still need to give the ”–color=auto” option in the grep command. There are two ways to do this, create a alias for grep as ”grep –color=auto” or specify the same in GREPOPTIONS.

Another option that is quite useful is ”-n” in conjuntion with ”-f”, which will show the line numbers also along with the filename.


Tags: color grep

Related Articles:


author

Authored By Amit Agarwal

Amit Agarwal, Linux and Photography are my hobbies.Creative Commons Attribution 4.0 International License.

We notice you're using an adblocker. If you like our webite please keep us running by whitelisting this site in your ad blocker. We’re serving quality, related ads only. Thank you!

I've whitelisted your website.

Not now
This website uses cookies to ensure you get the best experience on our website. Learn more Got it