regex - Recursively search directories beginning with string for inner directories matching pattern -


i trying find directories name's of 5 digits within directories beginning string, in example: test. directory structure like:

   |-1      |---12324    |-otherfile      |---23424    |-somefile      |---22343    |-test      |---22343      |---23424    |-testtemp      |---23454      |---adsf    |-testtemp1      |---34566    |-testtemp2      |---34543 

i 5 digit names in folders begin test, ignoring directories 1, otherfile, , somefile.

i'm trying this:

find ./test* d -name "\d+" print 

which gives error

find: print: unknown primary or operator

or

grep -r "./test*/\d{5}" 

which gives error

grep: warning: recursive search of stdin

what these errors mean? how can make search? nice if directories files in printed too. in mac terminal.

you can try -regex optin in find:

find ./test -regextype posix-egrep -type d -regex '.*/[0-9]{5}$' 

on osx use:

find -e ./test -type d -regex '.*/[0-9]{5}$' 

or without regex:

find ./test -type d -name '[0-9][0-9][0-9][0-9][0-9]' 

Comments

Popular posts from this blog

javascript - Bootstrap Popover: iOS Safari strange behaviour -

Magento/PHP - Get phones on all members in a customer group -

session - Logging Out Using PHP -