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



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 03-11-2010
Registered User
 

Join Date: Nov 2009
Posts: 6
Thanks: 0
Thanked 0 Times in 0 Posts
"find": search the a regex of FILES??

I want to use the find command to search a ton of files, but I want to break it up into multiple machines. I want to search for files with "filename." in the title.
The location I want to search is:

Code:
/u/*/*/*/stuff

On the first computer I want to search:

Code:
/u/[a-i]/*/*/stuff

Right now I am doing

Code:
find /u/*/*/*/stuff -iregex "/u/[a-i]/.*filename\..*" -print >>~/Desktop/find

This works correctly on the first machine, but for the second machine i will be searching [j-p] and in this case it will still search a-i first. I really want to do something like:

Code:
find /u/[j-p]/*/*/stuff -iregex ".*filename\..*" -print >>~/Desktop/find


Anyone know if/how I could do this?
Sponsored Links
    #2  
Old 03-12-2010
...@...
 

Join Date: Feb 2004
Location: NM
Posts: 8,511
Thanks: 67
Thanked 403 Times in 392 Posts
specify a list of directory names for find to look through

Code:
find u/1/2/3 u/a/b/s u/2/3/4/5  -type f -name '*filename*' -exec ls -l {} \;

the bracket [a-j] may not work on all unix machines.

If you have a gigantic list of directories put all of the directory names into a file, call it dirnames:

Code:
find $(awk '{printf(" %s ", $0)}' dirnames) -type f -exec ls -l {} \;

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
Delete files older than "x" if directory size is greater than "y" JamesCarter Shell Programming and Scripting 4 02-11-2010 07:41 AM
How to find all files containing "1234" in their inode number? daredevil82m UNIX for Dummies Questions & Answers 2 01-05-2010 11:37 AM
How to use the "grep/egrep" command to search files. rkhanal UNIX for Dummies Questions & Answers 6 01-19-2009 05:49 AM
"find command" to find the files in the current directories but not in the "subdir" swamymns Shell Programming and Scripting 9 07-22-2008 11:23 AM
grep to find content in between curly braces, "{" and "}," keshav_rk Shell Programming and Scripting 4 08-09-2007 10:14 PM



All times are GMT -4. The time now is 03:22 AM.