[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
sorting on space gives unexpected behaviour with sort 6.10
From: |
Dirk-Jan Faber |
Subject: |
sorting on space gives unexpected behaviour with sort 6.10 |
Date: |
Wed, 4 Jun 2008 14:29:12 +0200 |
User-agent: |
Mutt/1.4i |
Hello,
When trying to sort input that has spaces in it I am getting unexpected
behaviour. When using the inputfile:
8 3 7
7 2 4
6 3 6
14 3 10
8 6 2
9 5 10
10 1 1
14 1 3
14 4 5
5 3 7
Trying to sort this input gives:
$ cat in.txt | sort -t' ' -n -k1n -k2n -k3n
5 3 7
6 3 6
7 2 4
8 3 7
8 6 2
10 1 1
14 1 3
14 4 5
9 5 10
14 3 10
I would have expected the output to be different, the "9 5 10" line ought to be
before the line starting with the ten.
This bug can be bypassed by replacing the spaces with another character like
the semicolon:
$ cat in.txt | tr ' ' ':' | sort -t':' -n -k1n -k2n -k3n | tr ':' ' '
5 3 7
6 3 6
7 2 4
8 3 7
8 6 2
9 5 10
10 1 1
14 1 3
14 3 10
14 4 5
$ sort --version
sort (GNU coreutils) 6.10
Copyright ?? 2008 Free Software Foundation, Inc.
Licens GPLv3+: GNU GPL version 3 eller senare <http://gnu.org/licenses/gpl.html>
Detta ??r fri programvara: du f??r lov att ??ndra och vidaredistribuera den.
Det finns INGEN GARANTI, s?? l??ngt lagen till??ter.
Skrivet av Mike Haertel och Paul Eggert.
Hope you will be able to fix this.
Kind regards,
Dirk-Jan Faber
- sorting on space gives unexpected behaviour with sort 6.10,
Dirk-Jan Faber <=