LinuxQuestions.org
Review your favorite Linux distribution.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices



Reply
 
Search this Thread
Old 09-02-2005, 11:23 AM   #1
pteigeler
LQ Newbie
 
Registered: Sep 2005
Posts: 1

Rep: Reputation: 0
Find excluding multiple directories with a wildcard


Here is a very small sample of my current directory structure, not much I can do about it, but I think you get the picture.

./jan2003
./jan2004
./jan2005
./jul2002
./jul2003
./jul2004
./rawOct2003 There are subdirectories here also.
./rawOct2004 There are subdirectories here also.
./rawSep2002 There are subdirectories here also.
./rawSep2003 There are subdirectories here also.
./rawSep2005 There are subdirectories here also.
./rawaug2004 There are subdirectories here also.
./rawjul2004 There are subdirectories here also.
./rawjun2004 There are subdirectories here also.
./rawsep2004 There are subdirectories here also.
./repocommonfiles
./repotempDec2004
./repotempJan2003
./repotempJun2005
./repotempapr2002
./repotempapr2003
./repotempapr2004
./repotempapr2005
./repotempaug2002

Within the "raw" directories, and their subdirectories, are the files I am interested in doing a grep thru after the find command has completed using xargs. The remaining directories I would like to prune during the "find" command. Is there a way to do this without listing every directory in a -prune of its own??? In other words, I want to grep thru all of the files in all of the "raw" directories and all of their subdirectories (no matter what they may start with). I was thinking something like the following...

find . -not -path ./raw\* -prune -o -print | xargs grep abc *.txt

...but couldn't get it to work. Any suggestions? Thanx.

Paul
 
Old 09-02-2005, 11:57 AM   #2
druuna
LQ Veteran
 
Registered: Sep 2003
Posts: 10,532
Blog Entries: 7

Rep: Reputation: 2374Reputation: 2374Reputation: 2374Reputation: 2374Reputation: 2374Reputation: 2374Reputation: 2374Reputation: 2374Reputation: 2374Reputation: 2374Reputation: 2374
Hi,

Is this what you want:

find . -path './raw*' -name '*txt' -print

Hope this helps.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
excluding directories from commands David the H. Linux - General 5 04-06-2009 04:21 PM
tar, excluding directories recursively towlie Linux - Newbie 3 06-17-2004 01:32 PM
Excluding directories from zip files jonathanztaub Linux - General 1 05-17-2004 03:17 AM
find and copy files into multiple directories avargas22 Linux - Newbie 2 04-01-2004 12:11 PM
how to find file using wildcard? huangyanfeng Linux - General 3 10-15-2003 10:21 PM


All times are GMT -5. The time now is 01:21 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration