Re: find(1): I18N gone wild ?
- Reply: Jamie Landeg-Jones : "Re: find(1): I18N gone wild ?"
- In reply to: Jamie Landeg-Jones : "Re: find(1): I18N gone wild ?"
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Fri, 21 Apr 2023 19:12:40 UTC
Jamie Landeg-Jones wrote: > Yuri <yuri@aetern.org> wrote: > >>> https://pubs.opengroup.org/onlinepubs/9699919799/utilities/V3_chap02.html#tag_18_13 >>> >>> ...which in turn refers to the following link for bracket expressions: >>> >>> https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap09.html#tag_09_03_05 >>> >>> Why we don't support all of that is different story. >> >> A bit more on this; first link applies both to find(1) and fnmatch(3), >> and find uses fnmatch() internally (which is good), but even the >> function that processes bracket expressions is called rangematch() and >> that's really all it does ignoring other bracket expression rules: >> >> https://cgit.freebsd.org/src/tree/lib/libc/gen/fnmatch.c#n234 >> >> So to "fix" find we just need to implement the bracket expressions >> properly in fnmatch(). > > No. find "-name" works with GLOBs not regex. No, find "-name" works with pattern rules in the first link, please see: https://pubs.opengroup.org/onlinepubs/9699919799/utilities/find.html > The functionality you are talking about, and the page you quoted refer to regular expressions. The functionality I am talking about is defined in find specification above, the only relation to REs is for bracket expressions (with ! instead of ^). > For that, you use find "-regex" - note that the regex is assumed anchored, so: > > $ LANG=en_US.UTF-8 find -E /etc/rc.d -regex '.*[[:upper:]]+' -print > /etc/rc.d/NETWORKING > /etc/rc.d/FILESYSTEMS > /etc/rc.d/SERVERS > /etc/rc.d/DAEMON > /etc/rc.d/LOGIN > $ > > Jamie >