Re: sort
Jim Meyering <[email protected]> Fri, 02 May 2003 08:56:18 +0200
| Newsgroups | gmane.comp.gnu.textutils.bugs |
|---|---|
| Message-ID | <[email protected]> |
Gong Cheng <[email protected]> wrote: > sort -n cannot recognize scientific notation, e.g. > 3e-4 > 4e-5 > > it will say 4e-5 is bigger because it cannot recognize scientific notation To handle input in scientific notation, use --general-numeric-sort (-g). See the documentation (run `info sort') for a description of how -n works. Note that the last paragraph of the -n description says this: Neither a leading `+' nor exponential notation is recognized. To compare such strings numerically, use the `--general-numeric-sort' (`-g') option. E.g., $ printf '3e-4\n4e-5\n' |sort -g 4e-5 3e-4 Also, since you've reported this to the bug-textutils address, I suspect you will want to use a newer version: ftp://ftp.gnu.org/gnu/coreutils/coreutils-5.0.tar.bz2 (coreutils is the union of fileutils, textutils, and sh-utils)