Re: find with regex to find files matching pattern

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Thanks Ahmad

Mind totally blew by the regextype attribute... simple works as expected..

'ppreciate it..



On Mon, Dec 26, 2016 at 5:29 AM, Ahmad Samir <ahmadsamir3891@xxxxxxxxx> wrote:
> On 26 December 2016 at 07:47, bruce <badouglas@xxxxxxxxx> 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@xxxxxxxxxxxxxxxxxxxxxxx
> To unsubscribe send an email to users-leave@xxxxxxxxxxxxxxxxxxxxxxx
_______________________________________________
users mailing list -- users@xxxxxxxxxxxxxxxxxxxxxxx
To unsubscribe send an email to users-leave@xxxxxxxxxxxxxxxxxxxxxxx



[Index of Archives]     [Older Fedora Users]     [Fedora Announce]     [Fedora Package Announce]     [EPEL Announce]     [EPEL Devel]     [Fedora Magazine]     [Fedora Summer Coding]     [Fedora Laptop]     [Fedora Cloud]     [Fedora Advisory Board]     [Fedora Education]     [Fedora Security]     [Fedora Scitech]     [Fedora Robotics]     [Fedora Infrastructure]     [Fedora Websites]     [Anaconda Devel]     [Fedora Devel Java]     [Fedora Desktop]     [Fedora Fonts]     [Fedora Marketing]     [Fedora Management Tools]     [Fedora Mentors]     [Fedora Package Review]     [Fedora R Devel]     [Fedora PHP Devel]     [Kickstart]     [Fedora Music]     [Fedora Packaging]     [Fedora SELinux]     [Fedora Legal]     [Fedora Kernel]     [Fedora OCaml]     [Coolkey]     [Virtualization Tools]     [ET Management Tools]     [Yum Users]     [Yosemite News]     [Gnome Users]     [KDE Users]     [Fedora Art]     [Fedora Docs]     [Fedora Sparc]     [Libvirt Users]     [Fedora ARM]
  Powered by Linux