bug-coreutils
[Top][All Lists]
Advanced

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

Re: problem with command sort after uniq -c


From: Damien ANCELIN
Subject: Re: problem with command sort after uniq -c
Date: Tue, 11 Mar 2008 10:14:15 +0100
User-agent: Mozilla-Thunderbird 2.0.0.9 (X11/20080110)

You're right, my locale is set to fr_FR. I've tried with en_EN and en_US, and it works fine (and with -k1,1 too). I think I understand the problem with the locale fr_FR : in french, to write 123456.78 in a easily readable form you write 123 456,78 (and in english it's 123,456.78).

Thanks Philip and Andreas for your answers (and sorry for polluting the bug mailing list).
Damien

Andreas Schwab a écrit :
Damien ANCELIN <address@hidden> writes:

I met a problem with the sort command : I've used the uniq command with
the -c option to count some numbers, and then applying sort -n don't sort
lines by numeric order of the first field.
Here is an example (my sort version is 5.97) :
$ cat bug_sort | sort -n

This is a useless use of cat, you can just redirect sort's standard
input from the file.

  1320 51970
  1692 12345
 22681 8060
 26063 8649
  2668 33603
  3487 44496
  4350 23246
 47013 8000
  5447 20000
 81724 5000

I assume that you use the fr_FR locale.  In this locale a number can be
grouped with a space, thus it is considered part of the number.  If you
want to be sure that sort only considers the first field as sort key you
should use -k1,1 to limit it.  The default is to always use the the
whole line as sort key, and sort -n will take as much as possible from
the key to match a number.

Andreas.


--
Damien ANCELIN
INRIA - ENS-Lyon, LIP (RESO)
Bureau 322 Sud
Tel : +33 4 72 72 85 02





reply via email to

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