[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: question about behavior of sort -n -t,
From: |
Gabriel Gaster |
Subject: |
Re: question about behavior of sort -n -t, |
Date: |
Tue, 8 Oct 2013 19:00:52 -0500 |
That's true, but I think that the expected output would be for sort to assume
the data is comma-delimited, because -t, was specified in the command, and then
to sort on each field.
In your example, they actually result in the same thing. In this case, I think
it's only when the comma character doesn't make sense as a numeric that the
results would be different.
In other words, in an example in which a comma is actually *meant* to be both a
field-separator and a numeric character and the comma's are well-placed, then
the results will agree. If however, the comma does not make sense as a numeric,
as in the following example, then the results would be different and would not
make sense.
a,1,11
bb,4,321
c,1,1111
If any of the above is wrong, it's only because I know very little about unix.
Cheers,
Gabe
--
gabriel gaster
On Tuesday, October 8, 2013 at 6:34 PM, Pádraig Brady wrote:
> You could have data like:
>
> a,1,234
> bb,4,321
> c,1,111
>
> If you wanted to sort by those grouped numbers you'd need to honor the , in
> the locale
> and use sort -t, -k2n
>
> Perhaps this is something worth warning about in sort --debug.
> I.E. numeric specified and -t[$group|$decimal] specified,
> but I'm inclined to think it's not worth it.
>
> cheers,
> Pádraig.
- question about behavior of sort -n -t,, Gabriel Gaster, 2013/10/08
- Re: question about behavior of sort -n -t,, Eric Blake, 2013/10/08
- Re: question about behavior of sort -n -t,, Pádraig Brady, 2013/10/08
- Re: question about behavior of sort -n -t,, Eric Blake, 2013/10/08
- Re: question about behavior of sort -n -t,, Gabriel Gaster, 2013/10/09
- Re: question about behavior of sort -n -t,, Gabriel Gaster, 2013/10/09
- Re: question about behavior of sort -n -t,, Eric Blake, 2013/10/09
- Re: question about behavior of sort -n -t,, Gabriel Gaster, 2013/10/09