Ted, Chris, Thanks for straightening me out on this! Haven't had to pay much attention to locale before. Makes sense. -Brett On Fri, Jun 19, 2015 at 10:22 AM, Chris Thompson <wolcen@riseup.net> wrote:
Well, this may not get you only a subset of lower-case letters, but it does at least limit to lower case: [[:lower:]]. More details below.
e.g.:
ls [[:lower:]]*
Regards, Chris
See also:
http://www.tldp.org/LDP/GNU-Linux-Tools-Summar/html/x11655.htm#STANDARD-WILD...
man 7 glob ----------
Character classes and internationalization Of course ranges were originally meant to be ASCII ranges, so that "[ -%]" stands for "[ !"#$%]" and "[a-z]" stands for "any lowercase letter". Some UNIX implementations generalized this so that a range X-Y stands for the set of characters with code between the codes for X and for Y. However, this requires the user to know the character cod‐ ing in use on the local system, and moreover, is not convenient if the collating sequence for the local alphabet differs from the ordering of the character codes. Therefore, POSIX extended the bracket notation greatly, both for wildcard patterns and for regular expressions. In the above we saw three types of items that can occur in a bracket expression: namely (i) the negation, (ii) explicit single characters, and (iii) ranges. POSIX specifies ranges in an internationally more useful way and adds three more types:
(iii) Ranges X-Y comprise all characters that fall between X and Y (inclusive) in the current collating sequence as defined by the LC_COLLATE category in the current locale.
(iv) Named character classes, like
[:alnum:] [:alpha:] [:blank:] [:cntrl:] [:digit:] [:graph:] [:lower:] [:print:] [:punct:] [:space:] [:upper:] [:xdigit:]
so that one can say "[[:lower:]]" instead of "[a-z]", and have things work in Denmark, too, where there are three letters past 'z' in the alphabet. These character classes are defined by the LC_CTYPE category in the current locale.
It looks like a locale issue. In the old "C" locale, sorting a list put all cap letters before all lowercase letters. In the "en_US.UTF-8" locale, apparently the Ubuntu default, they're sorted as in a regular dictionary, regardless of caps.
For example:
ls apple berry Berry charlie
Hope that's more helpful than my first response! Ted
On Fri, Jun 19, 2015 at 9:46 AM, Theodore Ruegsegger <gruntly@gmail.com> wrote:
Disregard last transmission. I shoulda read your post more carefully.
Ted
On Fri, Jun 19, 2015 at 9:44 AM, Theodore Ruegsegger <gruntly@gmail.com> wrote:
b != B
HTH, Ted
On Fri, Jun 19, 2015 at 9:29 AM, Brett Russ <bruss@alum.wpi.edu> wrote:
Can someone explain this to my evidently inadequately caffeinated brain? I was trying to use a lower case character range wildcard to list all files not starting with an uppercase letter and I noticed it wasn't working as I'd expect. So I created this simple example and still don't understand what's happening.
Dir with two files:
brett@spider /tmp/test $ \ls apple Berry
This is what I'd expect to see:
brett@spider /tmp/test $ \ls [a-b]* apple
This makes no sense. Is this a bug?:
brett@spider /tmp/test $ \ls [a-c]* apple Berry
From here on are just a few extra examples confirming the oddity of
On 06/19/2015 09:58 AM, Theodore Ruegsegger wrote: the
above.
brett@spider /tmp/test $ \ls [a]* apple
brett@spider /tmp/test $ \ls [b]* ls: cannot access [b]*: No such file or directory
brett@spider /tmp/test $ \ls [c]* ls: cannot access [c]*: No such file or directory
brett@spider /tmp/test $ \ls a* apple
brett@spider /tmp/test $ \ls b* ls: cannot access b*: No such file or directory
brett@spider /tmp/test $ \ls c* ls: cannot access c*: No such file or directory
brett@spider /tmp/test $ dpkg -S `which ls` coreutils: /bin/ls
brett@spider /tmp/test $ dpkg -s coreutils Package: coreutils Essential: yes Status: install ok installed Priority: required Section: utils Installed-Size: 6020 Maintainer: Ubuntu Developers <ubuntu-devel-discuss@lists.ubuntu.com> Architecture: amd64 Multi-Arch: foreign Version: 8.21-1ubuntu5.1 [SNIP]
Thanks, Brett
_______________________________________________ Wlug mailing list Wlug@mail.wlug.org http://mail.wlug.org/mailman/listinfo/wlug
Wlug mailing list Wlug@mail.wlug.org http://mail.wlug.org/mailman/listinfo/wlug
_______________________________________________ Wlug mailing list Wlug@mail.wlug.org http://mail.wlug.org/mailman/listinfo/wlug