Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Fast recursive grepping of svn working copy [duplicate]

I need to search all cpp/h files in svn working copy for "foo", excluding svn's special folders completely. What is the exact command for GNU grep?

like image 363
Constantin Avatar asked Nov 29 '22 07:11

Constantin


2 Answers

I use ack for this purpose, it's like grep but automatically knows how to exclude source control directories (among other useful things).

like image 62
Greg Hewgill Avatar answered Dec 04 '22 04:12

Greg Hewgill


grep -ir --exclude-dir=.svn foo *

In the working directory will do. Omit the 'i' if you want the search to be case sensitive.

If you want to check only .cpp and .h files use

grep -ir --include={.cpp,.h} --exclude-dir=.svn foo *

like image 36
Sarien Avatar answered Dec 04 '22 04:12

Sarien