Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

filename pattern search in dynamically specified list of directories



i am currently using the following code to identify all files with X or 
greater number of digits in the filenames.  the list of directories in which 
to do the recursive search is dynamically generated.

i am using zsh cvs sources pulled 22 august 2008 and built under ubuntu 7.10 
on an intel platform; the displayed ZSH_VERSION is 4.3.6-dev-0.

the relevant, generalized code snippet i am using is shown here.  the job 
searches for dot files as well as non-dot files.

if anyone can offer suggestions for a simpler, cleaner one-liner, i'd very 
much appreciate the suggestions.

-----------------
#!/usr/local/bin/zsh

# set appropriate options.
setopt GLOB
setopt EXTENDED_GLOB
setopt NONULL_GLOB
setopt nonomatch

# create the test environment.
[[ ! -d tmp ]] && { mkdir tmp ; }
[[ ! -d tmp/subdir ]] && { mkdir tmp/subdir ; }
touch tmp/a001 tmp/b002 tmp/c-no-digits
touch tmp/subdir/one0011 tmp/subdir/two-no-digits

# the command to dynamically generate the desired list of directories.
com="echo tmp"

# the single line command to generate the list of selected files.
/bin/ls -C ${(f)"$(eval print -l (${${${${"$(echo ${${(f)${"$(eval 
${=com})"}}//(#m)(#s)*(#e)/${MATCH}|})"}// /}%|}//.\//})/**/{,.}*[[:digit:]]
(#c2,)* )"}
-----------------



Messages sorted by: Reverse Date, Date, Thread, Author