bug-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: problem with command sort


From: Greg Wooledge
Subject: Re: problem with command sort
Date: Mon, 1 Oct 2012 16:37:18 -0400
User-agent: Mutt/1.4.2.3i

On Mon, Oct 01, 2012 at 11:14:31AM +0000, eduardo.damasio-da-costa@stfc.ac.uk 
wrote:
> The command sort -k 3,3 lixo > lixo4 does not sort lixo as I was expecting.
> For example, by line 385 lixo4 shows:
> 69.1875  -59.2511  1.00242e-05
>  70.875  -62.0592  1.00242e-05
>  145.125  -74.9763  1.00252e-06
>  147.375  77.7844  1.00252e-06
>  151.312  78.346  1.00252e-06
>  15.75  80.0308  1.00252e-06
>  158.062  68.7986  1.00252e-06
>  158.625  68.237  1.00252e-06
>  191.25  73.8531  1.00252e-06
>  235.688  78.9076  1.00252e-06
>  327.938  -86.7694  1.00252e-06
>  93.9375  55.8813  1.00252e-06
>  95.0625  38.4711  1.00252e-06
>  10.125  -5.33541  1.00255e-05
>  14.625  40.1559  1.00255e-05
>  230.625  -64.8672  1.00255e-05
> that is, third column is not sorted.

This is not a bash bug -- in fact it's not a bug at all, but most
importantly, sort is an external program, not part of the bash shell.

If you wanted the third column to be sorted numerically, instead of as
a bunch of strings (which it's doing now), then you need to use the -n
or perhaps the -g option to sort.  (Note: -g is a GNU extension.)



reply via email to

[Prev in Thread] Current Thread [Next in Thread]