Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

I am executing this command to find certain files in specific directory:

find ./rgs/test/maesXX/master/stdlist -name \*.extract \
     -mtime +30 \! -size 0 -exec ls -lrt {} \;

where XX could be any number between 1-100.

Can I use a regex for this purpose? How would I do that? Are there other ways?

share|improve this question
    
Thanks for editing @Mat...It looks better now –  munish Jan 11 '12 at 6:44

1 Answer 1

up vote 8 down vote accepted

You can pass more than one path to find, so the best way (IMHO) is to let the shell do the expansion.

If you don't have other directories starting with maes there, then this should suffice, and is simpler:

find ./rgs/test/maes*/master/stdlist ...

But if you really need to match that pattern exactly, you can do

find ./rgs/test/maes[0-9][0-9]/master/stdlist ...

for maes00 -- maes99, or

find ./rgs/test/maes{[1-9],[1-9][0-9],100}/master/stdlist ...

for maes1 -- maes100 (I didn't get which one was your case).

share|improve this answer
    
thanks i get it –  munish Jan 11 '12 at 6:59

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.