Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 3 Oct 2011 14:37:09 +0200
From:      Jonathan McKeown <j.mckeown@ru.ac.za>
To:        freebsd-questions@freebsd.org
Subject:   Re: cat sort(1) sort floating point numbers?
Message-ID:  <201110031437.09327.j.mckeown@ru.ac.za>
In-Reply-To: <20111003120542.GA98919@mech-cluster241.men.bris.ac.uk>
References:  <20111003120542.GA98919@mech-cluster241.men.bris.ac.uk>

next in thread | previous in thread | raw e-mail | index | archive | help
On Monday 03 October 2011 14:05:42 Anton Shterenlikht wrote:
> I tried sorting a file with a column of floating
> point numbers (below) with sort(1) -n. However,
> the numbers seem to have been sorted by the first
> digit only.

sort -g

Due to the GNU project's obsession with info (<http://xkcd.com/912/>), you=
=20
can't readily find this out from the manpage - but the info documentation=20
available on the web for coreutils describes the difference between -g=20
and -n:

[when using -n] Neither a leading =E2=80=98+=E2=80=99 nor exponential notat=
ion is recognized.=20
To compare such strings numerically, use the --general-numeric-sort (-g)=20
option.

Jonathan



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201110031437.09327.j.mckeown>