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


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

回复