grep is a useful little *nix command line utility that makes it easy to search for strings in files. The real beauty comes when you start using it with pipes. One thing that kind of bothered me since I started using it, that it didn’t highlight the string you where searching for in it’s output.
Turns out, this can be accomplished very easily (should really just have reade the man page 😉 ).
Put the following in your shell startup script (/home/flo/.bashrc in my case)
Now that was simple wasn’t it (though you’ll have to re-log in to make it work or at least spawn another shell process, so the startup file gets sourced) 🙂
But now if you followed my tip and started using pipes like mad, after applying this tip, you’ll quickly encounter that the colors are gone again. To hand over colors to say the often used less program you have to make an alias that hands grep the --color=always option (don’t put this in GREP_OPTIONS it tends to break things!) and call less with the -R option.
Or simpler, just add the following to your shell startup script:
alias cgrep='grep --color=always'
[fa:p:p=3,id=435544984,j=l,s=t,l=p] Hi I’m back from London now. Had three absolutely superb days there. On the first day Olli & me had our fair share of beers in the typical inner city pubs and went out to Canary Warf in the evening with Maria & Sinead (yep, no sightseeing at all 😉 ).
[fa:p:p=3,id=435548894,j=r,s=t,l=p] Second day saw us getting up very late and then heading out to Campten Town markets. This thing absolutely rockz! I could spend a whole week there, shopping, looking and eating 🙂
[fa:p:p=3,id=435555561,j=l,s=t,l=p] Sadly we didn’t really have much time because we had to get back to the London east end to prepare the flat for Maria’s rockstar party.
Finally a party with decent music all night long. Find some more pics in my gallery!
It was awesome 🙂
This is really sick!
Justin is a guy from SF who decided to launch a site where he is streaming live video to the net 24/7.
I started Justin.tv because I thought it would awesome for people to see what it was like to be Justin.
Movies becoming reality and reality becoming a movie.
Right now it’s running for 22h, let’s see how long he can keep up 😉