bug-coreutils
[Top][All Lists]
Advanced

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

Re: Sort Bug


From: Robert . Dempsey
Subject: Re: Sort Bug
Date: Thu, 30 Oct 2003 10:15:11 +0000


Thank you for both of your responses

Here are the details you wanted

        address@hidden>locale
        LANG=POSIX
        LC_CTYPE="POSIX"
        LC_NUMERIC="POSIX"
        LC_TIME="POSIX"
        LC_COLLATE="POSIX"
        LC_MONETARY="POSIX"
        LC_MESSAGES="POSIX"
        LC_PAPER="POSIX"
        LC_NAME="POSIX"
        LC_ADDRESS="POSIX"
        LC_TELEPHONE="POSIX"
        LC_MEASUREMENT="POSIX"
        LC_IDENTIFICATION="POSIX"
        LC_ALL=

        address@hidden>sort --version
        sort (coreutils) 5.0.91
        Written by Mike Haertel and Paul Eggert.

        Copyright (C) 2003 Free Software Foundation, Inc.
        This is free software; see the source for copying conditions.  There is NO
        warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.


If it helps I work in a NFS environment, with Solaris, HP-UX and AIX.  Just to test that I wasn't going mad I ran the command

        ls -la | sort +4n

to sort by size on each system against the same directory.  They all worked ok


Rob




Paul Eggert <address@hidden>
Sent by: Paul Eggert <address@hidden>

29/10/2003 17:11

       
        To:        address@hidden
        cc:        address@hidden
        Subject:        Re: Sort Bug



I don't get the results that you do.  What is the output of the following
commands on your host?

sort --version
locale


address@hidden writes:

> address@hidden>ls -l | sort -k 5
> total 3165056
> -rw-r--r--    1 robertd  users         678 Jul 10 15:15 rejected_tms_inbox.dmp.gz
> -rw-r--r--    1 robertd  users         840 Jul 21 13:50 161examples.dmp.gz
> -rw-r--r--    1 robertd  users        2446 Aug 14 13:32 prob.dmp.gz

That's not what sort -k 5 is supposed to do.  It's supposed to sort
lexicographically, so the proper order for the 1st four lines is:

total 3165056
-rw-r--r--    1 robertd  users        2446 Aug 14 13:32 prob.dmp.gz
-rw-r--r--    1 robertd  users         678 Jul 10 15:15 rejected_tms_inbox.dmp.gz
-rw-r--r--    1 robertd  users         840 Jul 21 13:50 161examples.dmp.gz

because 2446 lexicographically precedes 678 (because "2" precendes "6").

You probably want "sort -k 5n" or something like that.  However, it's still
worrisome that "sort -k 5" doesn't work as it should.



reply via email to

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