Hi,
either I misunderstand the documentation, or there is a subtle bug in
sort, when used with option '-g'.
As the minus sign ('-') has an ASCII value higher than the digits,
negative numbers end up after the positive ones, when using lexical (not
numerical) sort:
$ sort -g
[IN ] 2
[IN ] -3
[OUT] -3
[OUT] 2
Using the option "-g" gives the correct result, of course:
$ sort -g
[IN ] 2
[IN ] -3
[OUT] -3
[OUT] 2
However, when two keys are present, this fails to work:
$ sort -g
[IN ] 5 2
[IN ] 5 -3
[OUT] 5 2
[OUT] 5 -3
For only positive values, there is no problem:
$ sort -g
[IN ] 5 2.5
[IN ] 5 1.5
[OUT] 5 1.5
[OUT] 5 2.5
Is this a bug?
The examples above have been produced with sort from coreutils 5.2.1 on
RedHat Linux:
$ sort --version
sort (coreutils) 5.2.1
Written by Mike Haertel and Paul Eggert.
Copyright (C) 2004 Free Software Foundation, Inc.
[...]
$ rpm -q coreutils
coreutils-5.2.1-31.4
$ uname -a
Linux dopey.uibk.ac.at 2.6.9-42.0.2.ELsmp #1 SMP Thu Aug 17
18:00:32 EDT 2006 i686 i686 i386 GNU/Linux
Best regards,
Simon Anders
--
+---
| Simon Anders, Dipl. Phys.
| Institut fuer Theoretische Physik, Universitaet Innsbruck, Austria
| Tel. +43-512-507-6207, Fax -2919
| preferred (permanent) e-mail: [EMAIL PROTECTED]
_______________________________________________
Bug-coreutils mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/bug-coreutils