Simon Oosthoek <[EMAIL PROTECTED]> writes: > When sorting the data below (which is already sorted by sort) using > "sort -n" which should numerically sort on the first column (equiv > to sort -n -k 1) gives inconsistent output w.r.t numbers with > missing digits.
I don't get the same results that you do. When I use "sort -n", all the output comes in the expected order. I do get the same output that you do if I specify plain "sort" without "-n". Perhaps your "sort" wasn't being invoked as you expected? > This output is derived from ns-2 simulator output, which outputs floating > point numbers in a variety of ways (including exponential formatting) Then you should use -g instead of -n, assuming you don't mind the slower performance and the slightly-wrong answers due to floating-point rounding errors. Also (as Andreas Schwab mentioned) if you care about how ties are broken, you may need to specify "sort -k 1,1g ...". > I figure sort -n doesn't convert the data to be sorted to a floating point > number. That's correct, but "sort -n" should still work as you expected for your input. Here are the details about my configuration, if you want to compare notes as to why yours isn't working: $ sort --version sort (coreutils) 5.2.0 Written by Mike Haertel and Paul Eggert. Copyright (C) 2004 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. $ uname -a Linux penguin 2.4.18-bf2.4 #1 Son Apr 14 09:53:28 CEST 2002 i686 unknown unknown GNU/Linux $ locale LANG=C LC_CTYPE="en_US" LC_NUMERIC="en_US" LC_TIME="en_US" LC_COLLATE="en_US" LC_MONETARY="en_US" LC_MESSAGES="en_US" LC_PAPER="en_US" LC_NAME="en_US" LC_ADDRESS="en_US" LC_TELEPHONE="en_US" LC_MEASUREMENT="en_US" LC_IDENTIFICATION="en_US" LC_ALL=en_US _______________________________________________ Bug-coreutils mailing list [EMAIL PROTECTED] http://mail.gnu.org/mailman/listinfo/bug-coreutils