[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Does sort handle -t / correctly
From: |
Peng Yu |
Subject: |
Re: Does sort handle -t / correctly |
Date: |
Fri, 17 Apr 2015 14:08:06 -0500 |
On Fri, Apr 17, 2015 at 2:05 PM, Peng Yu <address@hidden> wrote:
> On Fri, Apr 17, 2015 at 12:31 PM, Eric Blake <address@hidden> wrote:
>> On 04/17/2015 11:03 AM, Peng Yu wrote:
>>> On Fri, Apr 17, 2015 at 11:26 AM, Eric Blake <address@hidden> wrote:
>>>> On 04/17/2015 10:10 AM, Peng Yu wrote:
>>>>> Hi, I got the following results when I call sort with -t /. It seems
>>>>> that 'a/1.txt' should be right after 'a'. Is it the case? Or I am not
>>>>> using sort correctly?
>>>>
>>>> Your assumption is correct - you are using sort incorrectly, by failing
>>>> to take locales into account, and by failing to limit the amount of data
>>>> being compared to single field widths.
>>>
>>> Thanks for the explanation.
>>>
>>> If I don't know the number of fields, but I want to sort according to
>>> all fields (from 1 to whatever the max number of fields), is there a
>>> way to do it?
>>
>> No one has really asked for that before. Are you going to propose some
>> possible extension syntax to make it obvious how to generate as many key
>> specifications as necessary to fully cover an arbitrary number of fields
>> in a line?
>
> Since no -k options means treat each line just a whole string, maybe
> one can allow -k without specifying any columns as treating each line
> as all the set of fields in that line?
BTW, one application of this syntax is to sort `find` is output. I.e.,
one want to put things under a directory to right after the directory
name itself.
My proposed syntax would work for this problem. But maybe there is an
alternative solution to this problem?
--
Regards,
Peng