bug-coreutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: bug in sort numeric mode with . separator


From: Bob Proulx
Subject: Re: bug in sort numeric mode with . separator
Date: Wed, 1 Dec 2004 12:50:42 -0700
User-agent: Mutt/1.5.6+20040907i

address@hidden wrote:
> 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'.'

As long as we are talking about being more robust, I cringe at seeing
the 'echo -e' there.  That assumes you have a shell that requires or
uses -e and, for example, HP-UX and other SysV-like systems are not
one of those.  Using 'printf' seems more robust to me.

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

Bob




reply via email to

[Prev in Thread] Current Thread [Next in Thread]