UNIX find command - using multiple -name options


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers UNIX find command - using multiple -name options
# 1  
Old 11-27-2012
UNIX find command - using multiple -name options

Hi all,

What am trying do is search for a directory that is owned by cm that only exists in a path that has a particular directory

ex: what I'm using now is
Code:
find . -user cm -name '*.rel' -type d -exec ls -dl {} \;

This is giving me stuff like this
Code:
./../../foo1/../../*.rel
./../../foo2/../../*.rel
./../../foo1/../../*.rel
etc..

I only want to see the .rel directories that are a sub-directory of foo2, not foo1

Is there any way to do this? Thanks in advanced.

Last edited by joeyg; 11-27-2012 at 04:21 PM.. Reason: Please wrap data and sripts with CodeTags
# 2  
Old 11-27-2012
try:
Code:
find . -user cm -name '*.rel' -type d -path '*/foo2/*' -exec ls -dl {} \;

# 3  
Old 11-27-2012
Thanks. That worked.
 
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Multiple search options in find command

Hi, I'd like find multiple file options to fetch different types of files. find /path...// -type f -name "*.log" -o -name "*.req" -o -name "*.txt" -mtime +5 -exec ls -l {} \; Where as in the above command only the last .txt files its retriving but not .log and .req files can body help... (1 Reply)
Discussion started by: Y.balakrishna
1 Replies

2. Shell Programming and Scripting

Processing Multiple Arguments in Command Line Options

Hi All, I am new to scripting. Could you please assist me . Here is my requirement. I have written a script that has 2 option flags defined. -l) calls some function with the arguments passed in front of -l -r) calls second function with the arguments passed in front of -r *) calls the... (7 Replies)
Discussion started by: Jay Deshpande
7 Replies

3. Shell Programming and Scripting

[Solved] Sed error - multiple number options to `s' command

Hi All, I am having two files (file1 & file2) and a filelist.txt file below. file1: $$STRINGVAR1=5 $$STRINGVAR2=10 $$LAST_UPD_DT_TBL1=12/12/2010 12:00:00 $$STRINGVAR3=100 $$LAST_UPD_DT_TBL2=01/01/2010 12:00:00... (8 Replies)
Discussion started by: Chandru_Raj
8 Replies

4. Shell Programming and Scripting

Find multiple string in one file using find command

Hi, I want find multiple string in one file using find coomand. And keeping it in one variable.grep is not working. (5 Replies)
Discussion started by: vivek1489
5 Replies

5. UNIX for Dummies Questions & Answers

Unix : About options of clear command ?

Hello everyone, My question is quite simple, even if I didn't find an answer. I would want a command (maybe clear with some options ?) that can do the following : clear completely the console, as it is when we start a console for the first time. My problem is that I sometimes display a lot... (5 Replies)
Discussion started by: Ben31400
5 Replies

6. UNIX for Dummies Questions & Answers

grep command to find multiple strings in multiple lines in a file.

I want to search files (basically .cc files) in /xx folder and subfolders. Those files (*.cc files) must contain #include "header.h" AND x() function. I am writing it another way to make it clear, I wanna list of *.cc files that have 'header.h' & 'x()'. They must have two strings, header.h... (2 Replies)
Discussion started by: ritikaSharma
2 Replies

7. Shell Programming and Scripting

find command to use multiple -exec options

Hello All, Is there a way to make exec do a couple of operations on a single input from find? For example, find . -type d -exec ls -l "{}" ";" I would like to give the result of each "ls -l" in the above to a wc. Is that possible? I want to ls -l | wc -l inside exec. How do I... (1 Reply)
Discussion started by: prasanna1157
1 Replies

8. Linux

Simplified find command to find multiple file types

Hi, I'm using the following command to find the multiple requierd file types and its working fine find . -name "*.pl" -o -name "*.pm" -o -name "*.sql" -o -name "*.so" -o -name "*.sh" -o -name "*.java" -o -name "*.class" -o -name "*.jar" -o -name "*.gz" -o -name "*.Z" -type f Though... (2 Replies)
Discussion started by: vickramshetty
2 Replies

9. UNIX for Dummies Questions & Answers

find command sort options?

Hi - are there sort options with the find command? I don't see any in man. I have a script that is looping through a set a files to be processed and I need to process them in date timestamp order. tia for file in `find ${LANDING_FILE_DIR}${BTIME_FILENAME_PATTERN1}` do.... ... (6 Replies)
Discussion started by: mavsman
6 Replies

10. UNIX for Dummies Questions & Answers

Find command with prune and exec options

Hi, I'm using the following command to get a list of files on the system. find /releases -type f -exec ls -l > /home/sebarry/list.txt '{}' \; however, its searching a directory I don't want it to search so I know I have to use prune but I don't seem to be able to get prune and exec to work... (2 Replies)
Discussion started by: Sebarry
2 Replies
Login or Register to Ask a Question