Tags:

Smart grep with SVN

Monday, March 7, 2011 EST (Updated on: Wednesday, August 3, 2011 EDT)

by: Eric Potvin

Tags: ubuntu linux svn

Looking for code in PHP files with grep is great! Grep is one of the best command of Linux to find what you need quickly.

But if you are like me, you don't want to see what's in the SVN repository hidden folder and/or the smarty cached files.

To remove SVN repository files, you need to add to the grep:

grep -v "\.svn"
Now to remove the smarty files:
grep -v %%
Now let's add some color (mandatory):
grep "search_criteria" --color
Now the final command:
grep -r "search_criteria" /home/user/path/* | grep -v "\.svn" | grep -v %% | grep "search_criteria" --color

Be the first to reply!

No comments!
Share this article:

Add a comment

* If your comment require a response from us, please make sure you leave your email

Captcha

* is required
The posting of advertisements, profanity, or personal attacks is prohibited.
Please review our terms of use

Latest Articles

Top Articles

Category List

Top of the page
Loading, please wait ...