Matthew M. Boedicker wrote:
Sorry, this isn't a bug. Should have read the FAQ. "export LC_ALL=POSIX"
fixed it.

Well really that's just relying on the fact that '.' is before [0-9] in the C locale. The following is more explicit/robust and should work for all locales:

echo -e "80.58.11.107\n80.58.1.111" | sort -k1,1n -k2,2n -k3,3n -k4,4n -t'.'

`info sort` has loads of great examples explaining this
(very confusing) behaviour. The essential point I'm quoting
from the info docs is:

"""
      sort -t : -k 2,2n


Note that if you had written `-k 2' instead of `-k 2,2' `sort' would have used all characters beginning in the second field and extending to the end of the line as the primary _numeric_ key. For the large majority of applications, treating keys spanning more than one field as numeric will not do what you expect. """

I guess it's only has that confusing behaviour (i.e. not
treating the field specifier specially) for backwards compatability?

--
P�draig Brady - http://www.pixelbeat.org
--


_______________________________________________ Bug-coreutils mailing list [EMAIL PROTECTED] http://lists.gnu.org/mailman/listinfo/bug-coreutils

Reply via email to