在coreutils的7.0版本才有这个选项
sort --version-sort|-V

http://git.savannah.gnu.org/gitweb/?p=coreutils.git;a=commit;h=4c9fae4e97d95a9f89d1399a8aeb03051f0fec96

lenny stable用的还是6.10

2009/5/12 WANG Yunfeng <[email protected]>:
> Dongsheng Song 写道:
>>
>> 谢谢,原来 “-k” 还能这样多次使用呢,长见识了。
>>
>> 2009/5/12 Alyex Ye <[email protected]>:
>>>
>>> 正解
>>> sort -n -t\. -k1,1 -k2,2 -k3,3 -k4,4 ip.txt
>>>
>>> 求助Google得来
>>> http://www.madboa.com/geek/sort-addr/
>>>
>
> $ sort --version-sort <<EOF
>> 192.168.2.234
>> 192.168.2.51
>> 192.168.2.247
>> 192.168.4.51
>> 192.168.2.50
>> 10.10.66.207
>> 10.1.160.53
>> EOF
> 10.1.160.53
> 10.10.66.207
> 192.168.2.50
> 192.168.2.51
> 192.168.2.234
> 192.168.2.247
> 192.168.4.51
>



-- 
Best Regards,
Alyex


--
To UNSUBSCRIBE, email to [email protected]
with a subject of "unsubscribe". Trouble? Contact [email protected]

回复