Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

AIX find command with pattern list question 2

Status
Not open for further replies.

humprhey

Programmer
Mar 7, 2007
3
US
I want to do a search for files with a name of DExxxxxxx.ext and FGxxxxxx.ext using the find command.

So far I have tried:
find /search/path -name "@(DE|FG)*.ext"

this doesn't return much, if I leave the quotes out, the korn shell will do the pattern matching instead of the find command. This works if I don't have a lot of files, otherwise I get "arg list too long" message.

Am I missing something? Is the find command capable to do pattern matching in AIX, korn shell?

Thanks in advance for your replies.
 
You should be able to do something like this:

find /search/path -name DExxxxxxx.ext -o -name FGxxxxxx.ext

Put any other find options - such as -print - at the end.
 
find /search/path \( -name 'DE*.ext' -o -name 'FG*.ext' \)

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
Thanks for the replies. I was aware of the "-o" option and just I wanted to get a little more simplistic by crunching everything into one expression.

=)
 
Perhaps this will suffice:
find /search/path -name '[DF][EG]*.ext'

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
You can do like this:

find . -name "[DF][EG]??????.ext"

But perhaps it is not restrictive enough, as any combination DE??????, DG??????, FE?????? and FG?????? is ok for this pattern...


HTH,

p5wizard
 
p5wizard, I was doing it like you suggested, but as you mentioned as well, it is not restrictive enough.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top