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


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 !!

Closed Thread    
 
Thread Tools Search this Thread Display Modes
    #1  
Old 04-10-2008
Registered User
 
Join Date: Oct 2005
Location: Bellevue, WA
Posts: 121
Thanks: 0
Thanked 0 Times in 0 Posts
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\\)"
Sponsored Links
    #2  
Old 04-11-2008
era era is offline Forum Advisor  
Herder of Useless Cats (On Sabbatical)
 
Join Date: Mar 2008
Location: /there/is/only/bin/sh
Posts: 3,653
Thanks: 0
Thanked 8 Times in 8 Posts
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?)
Sponsored Links
Closed Thread

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Find with Prune not working wonderbison UNIX for Dummies Questions & Answers 4 07-13-2011 05:20 AM
Find prune Trash glev2005 UNIX for Dummies Questions & Answers 0 02-11-2011 10:17 AM
Find + prune + mtime Nicol Shell Programming and Scripting 4 03-10-2010 02:55 AM
How to use -path and -prune with find siegfried Shell Programming and Scripting 6 10-27-2009 04:46 PM
find with prune option apsprabhu Shell Programming and Scripting 1 10-01-2009 01:01 AM



All times are GMT -4. The time now is 07:13 PM.