Whether you are using Linux on the desktop or as a server, it's still good that you're using Linux. Linux related questions go here.
Moderator: General Moderators
alex.barylski
DevNet Evangelist
Posts: 6267 Joined: Tue Dec 21, 2004 5:00 pm
Location: Winnipeg
Post
by alex.barylski » Sun Nov 30, 2008 11:18 pm
Code: Select all
"grep -RnH '$what' $PROJECT_FIND_PATH "
I need the line numbers and such that grep offers (unless find does too?) the the results are expected in 'grep' format so find won't work unless it returns the results *exactly* the same...
I need to somehow ignore .svn directories -- possible?
Cheers,
Alex
VladSun
DevNet Master
Posts: 4313 Joined: Wed Jun 27, 2007 9:44 am
Location: Sofia, Bulgaria
Post
by VladSun » Mon Dec 01, 2008 3:09 am
As you know, you can always use
find instead of
grep -R
Code: Select all
grep -nH $what `find '$where' -wholename '*/.svn*' -prune -o -print -type f`
There are 10 types of people in this world, those who understand binary and those who don't
alex.barylski
DevNet Evangelist
Posts: 6267 Joined: Tue Dec 21, 2004 5:00 pm
Location: Winnipeg
Post
by alex.barylski » Mon Dec 01, 2008 7:28 pm
Dude...your the man.
Awesome...but I assume $where is project path?
Killer stuff...thanks again
Chris Corbyn
Breakbeat Nuttzer
Posts: 13098 Joined: Wed Mar 24, 2004 7:57 am
Location: Melbourne, Australia
Post
by Chris Corbyn » Sat Dec 06, 2008 4:38 pm
I usually just do this:
Code: Select all
grep something /path | grep -v .svn
grep does have an --exclude=pattern option too.
VladSun
DevNet Master
Posts: 4313 Joined: Wed Jun 27, 2007 9:44 am
Location: Sofia, Bulgaria
Post
by VladSun » Sat Dec 06, 2008 7:17 pm
It's a too much resource consuming solution
I mean -
grep for a text is slower than pre-excluding directories not to be searched by using
find .
And I'm not sure whether the
--exclude=PATTERN option will match against full path string or file name string.
There are 10 types of people in this world, those who understand binary and those who don't