GNU bug report logs - #7878
"sort" bug--inconsistent single-column sorting influenced by other columns?

Previous Next

Package: coreutils;

Reported by: Randall Lewis <ralewis <at> yahoo-inc.com>

Date: Fri, 21 Jan 2011 02:36:02 UTC

Severity: normal

Done: Bob Proulx <bob <at> proulx.com>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: Paul Eggert <eggert <at> cs.ucla.edu>
To: Randall Lewis <ralewis <at> yahoo-inc.com>
Cc: "7878-done <at> debbugs.gnu.org" <7878 <at> debbugs.gnu.org>
Subject: bug#7878: "sort" bug--inconsistent single-column sorting influenced by other columns?
Date: Fri, 21 Jan 2011 01:25:41 -0800
On 01/20/2011 11:29 PM, Randall Lewis wrote:
> Also, who would've thought that the default "sort" would be incompatible with "join" and that you would need to write the command like this every time you wanted to use "join"?
> 
> LC_ALL=C sort test1.txt

No, "sort" and "join" use the same collating sequence by default.

It sounds like you have a different problem: you
weren't sorting by the same field that you were
joining on.  For example, if you want to use plain
"join" then you need to sort via "sort -k 1b,1".
Or, if you want to use "join -t '|'" then you
also need to use "sort -k 1,1 -t '|'".

This is documented in the coreutils manual.

It may be that "LC_ALL=C sort" worked around your
problem on your particular test case, but it won't
work in general.




This bug report was last modified 14 years and 126 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.