Re: ls -la sort order
On 10/3/18, Roberto C. Sánchez <roberto@debian.org> wrote:
> On Wed, Oct 03, 2018 at 01:51:54PM -0400, Lee wrote:
>>
>> Sure - I can understand some people wanting A a to sort together. But
>> ignoring non-alpha characters when sorting??? Eventually I'm sure I
>> can get used to
>> Music
>> old
>> Pictures
>>
>> but this order is obnoxious
>> .mozilla
>> Music
>> old
>> Pictures
>> .profile
>> Public
>>
>
> While it may not particularly intuitive, I would not call it obnoxious.
> In English, the '.' would not customarily be used to make lexical
> sorting decisions.
>
> Dr. Jiles
> Dr Jones
> Dr. Jurgenson
>
> That would be the sort order I expect (for English, or most any other
> natural language locale).
Which is probably why I'm having such a hard time accepting the
en_US.utf8 sort order. I want the "computer" rules, not the natural
language rules.
> Either of
>
> Dr Jones
> Dr. Jiles
> Dr. Jurgenson
>
> or
>
> Dr. Jiles
> Dr. Jurgenson
> Dr Jones
>
> would seem incorrect to me.
<grin> what seems incorrect to me is that the data isn't normalized.
I'd do something like
sed -e 's/^Dr /Dr. /' | sort
> I suspect that collation function has no
> way of knowing whether the punctuation is important or not, so it must
> adhere to the rules specified in the locale (to ignore it in this case).
> You could always write a custom locale that sorts punctuation before or
> after letters, as you like. The locale(5) man page would be a good
> place to start for that.
ok - I'll take a look
>> I don't think I'll ever get used to that. I'm just a bit concerned
>> that setting LC_COLLATE=C is going to break something & I'll have a
>> heck of a time figuring out it was because I changed the sort order.
>>
>
> Call me old school, but I have LC_COLLATE=C in every shell profile on
> every machine that I use. I find that sorting is most important to me
> at the shell prompt (and usually when using ls). There has never been
> instance where I encountered an oddity that I even suspected related to
> my choice of LC_COLLATE.
Good to know! Thank you
Lee
Reply to: