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