Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
find
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Other Things Gentoo
View previous topic :: View next topic  
Author Message
bluesky
Apprentice
Apprentice


Joined: 14 Aug 2002
Posts: 230
Location: USA

PostPosted: Wed Nov 20, 2002 7:35 pm    Post subject: find Reply with quote

I like to do a search for a file(ex: apache) in all the directories but excluding the /usr/portage and the /var. Si there a simple way to do it?
I was thinking of find with the option -prune but it didn't seem to work. :)
_________________
bluesky

"free as the wind"
Back to top
View user's profile Send private message
mooman
Apprentice
Apprentice


Joined: 06 Nov 2002
Posts: 175
Location: Vancouver, WA

PostPosted: Wed Nov 20, 2002 7:51 pm    Post subject: Reply with quote

Personally (and this may not be the best way, but it's how I do it), I tend to rely on locate and grep a lot. One handy flag to remember in grep is -v which excludes a pattern.

So my approach to your scenario would have been:
locate apache | grep -v portage | grep -v var | more

Yeah, I know you can use regexs to combine the 'portage' and 'var' bits, but this is my brute force, no thinking required approach...

Now read the articles that follow for the right way to do it. ;)
_________________
Linux user off and on since circa 1995
Back to top
View user's profile Send private message
some_bob
Tux's lil' helper
Tux's lil' helper


Joined: 23 Jul 2002
Posts: 94

PostPosted: Fri Nov 22, 2002 8:26 pm    Post subject: Reply with quote

you could try something like:

find . -path './usr/portage' -prune -o -name apache

This would exclude /usr/portage. I don't think you can have more than a single exclude path in a single statement so you might have to chain them together. I could be wrong though... try experimenting.
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Other Things Gentoo All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum