The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > UNIX for Dummies Questions & Answers
Google UNIX.COM


UNIX for Dummies Questions & Answers If you're not sure where to post a UNIX or Linux question, post it here. All UNIX and Linux newbies welcome !!

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
find command with prune help venu_nbk UNIX for Dummies Questions & Answers 2 05-28-2007 03:25 AM
find with prune option highlt UNIX for Advanced & Expert Users 11 01-04-2007 08:29 AM
Find command with prune and exec Sebarry UNIX for Advanced & Expert Users 1 06-18-2006 10:43 AM
Use -prune with find command on AIX FuzzySlippers UNIX for Dummies Questions & Answers 5 11-08-2002 06:24 AM

Reply
 
Submit Tools LinkBack Thread Tools Search this Thread Display Modes
  #1  
Old 04-10-2008
Registered User
 

Join Date: Oct 2005
Posts: 86
How to prune multiple branches with find?

I wanted to prune multiple branches and only the first one is being pruned. What am I doing wrong?

I tried using "-a" instead of "-o" with no luck!

Also, is there an easier way to accommodate file names with spaces other than that sed command?
Thanks,
Siegfried

/usr/bin/find . \( -path ./Application/PRD -prune -o -path ./setup/products/PRDWeb -prune -o -path ./products/PRDWeb -prune \) -o -print | sed -e 's/^.*$/"\0"/' | xargs grep -in "PRD\\(WEB\\(UID\\|PWD\\|SERVER\\)\\|UID\\|PWD\\|USERNAME\\|PASSWORD\\|SERVER\\)"
Reply With Quote
Forum Sponsor
  #2  
Old 04-11-2008
era era is offline
Herder of Useless Cats
 

Join Date: Mar 2008
Location: /there/is/only/bin/sh
Posts: 3,650
Your pruning example works for me.

If your find understands -print0 then the sed is necessary. You should of course also tell xargs to use zero-terminated strings with -0 (maybe that's your problem?)
Reply With Quote
Google The UNIX and Linux Forums
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes




All times are GMT -7. The time now is 08:00 PM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited.
The UNIX and Linux Forums Content Copyright ©1993-2008. All Rights Reserved.Ad Management by RedTyger Visit The Complex Event Processing Blog

Content Relevant URLs by vBSEO 3.2.0