The UNIX and Linux Forums  


Go Back   The UNIX and Linux Forums > Top Forums > UNIX for Advanced & Expert Users
.
google unix.com




View Single Post in the UNIX and Linux Forums - Click on the Thread or Permalink to View Entire Thread -->
  #1 (permalink)  
Old 12-19-2006
highlt highlt is offline
Registered User
  
 

Join Date: Dec 2006
Posts: 8
find with prune option

Hello-

I'm trying to write a find command that will exclude certain directories to speed up the find and search the rest of the directory structure to list any files that contain the specified values listed in my egrep.

Specifically, I want the command below to search the current directory and all sub-directories EXCEPT for the "log" and "out" directories and give me a list of file names that contain "sun1216, sun1586, sun1153, PRIVIS1, PRIVIS2". I expected the command below to do the trick but it appears to not work.

find . -follow \( -name "log" -o -name "out" \)
-prune | xargs egrep -li "sun1216|sun1586|sun1153|PRIVIS1|PRIVIS2"

Any suggestions on what's wrong?
Any suggestion on using exec versus xargs?

Thanks