On 26 December 2016 at 07:47, bruce <badoug...@gmail.com> wrote:
> ls /cloud_nfs/*PID.dat
>
> /cloud_nfs/1.2.3.4_PID.dat
> /cloud_nfs/100.2.3.4_PID.dat
>
>
> find . -regex  '*\./*(\d+.\d+)*'   ----not working.. ive seen multiple
> examples.. so i'm doing something wrong...
>
> i've cd'd to the dir in question to run the test find...
>

cd to the dir, then:
find . -regextype posix-egrep -regex "\./[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+.*"

'-regextype posix-egrep' or '-regextype posix-extended' should work.
Note that neither of them understand \d, to match a digit you'd have
to use '[0-9]' or '[[:digit:]]'.

A couple of points:
1.  '*' alone (like you put at the beginning of your regexp above)
won't work, because, IIUC, it's a quantifier:
* matches zero or more occurrences of the regexp before it
? matches zero or one occurrences of the regexp before it
+ matches one or more occurrences of the regexp before it

2. -regex doesn't match on the file name only but rather on the whole
path so after you cd you have to put '\./' at the beginning of the
regexp, because the output has ./ before every file:
$ find .
.
./1.2.3.4_PID.dat
./100.2.3.4_PID.dat

-- 
Ahmad Samir
_______________________________________________
users mailing list -- users@lists.fedoraproject.org
To unsubscribe send an email to users-le...@lists.fedoraproject.org

Reply via email to