In article <s43304-3pj.ln1@xxxxxxxxxxxxxxxxxxxxxxx>,
The Ghost In The Machine <ewill@xxxxxxxxxxxxxxxxxxxxxxx> wrote:
> Problematic: try
>
> find /usr/local/ldb/db -name '.*[0-9][0-9]*.*' -maxdepth 1 | while read file
>
> or
>
> find /usr/local/ldb/db -name '[0-9]*' -maxdepth 1 | while read file
>
> or
>
> find /usr/local/ldb/db -name '[0-9]' -maxdepth 1 | while read file
>
> depending on whether one wants filenames containing digits, or filenames
> with *only* digits, or filenames consisting of a single digit.
Only the last one of these works, because -name uses shell-style
globbing, not regular expression matching. The first matches names that
start with a dot, contain another dot, and have at least two consecutive
digits somewhere between those two dots.
The second matches names that begin with a digit.
There is a -regex option that might be pressed into service here, but
I'll leave it to someone else to figure out how to get its particular
flavor of regular expressions to work here.
--
--Tim Smith
|
|