| View previous topic :: View next topic |
| Author |
Message |
bluesky Apprentice


Joined: 14 Aug 2002 Posts: 230 Location: USA
|
Posted: Wed Nov 20, 2002 7:35 pm Post subject: find |
|
|
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 |
|
 |
mooman Apprentice


Joined: 06 Nov 2002 Posts: 175 Location: Vancouver, WA
|
Posted: Wed Nov 20, 2002 7:51 pm Post subject: |
|
|
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 |
|
 |
some_bob Tux's lil' helper


Joined: 23 Jul 2002 Posts: 94
|
Posted: Fri Nov 22, 2002 8:26 pm Post subject: |
|
|
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 |
|
 |
|