用这个
sort -n -t \. -k4 ip.txt

在man sort中:
       -k, --key=POS1[,POS2]
              start a key at POS1, end it at POS2 (origin 1)


2009/5/12 Dongsheng Song <[email protected]>:
> 用 sort 得不到期望的结果:
>
> $ cat ip.txt  | sort -t . -n
> 192.168.2.234
> 192.168.2.237
> 192.168.2.246
> 192.168.2.247
> 192.168.2.28
> 192.168.2.50
> 192.168.2.51
>
> 谢谢!
>



-- 
Best Regards,
Alyex


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

回复