正解 sort -n -t\. -k1,1 -k2,2 -k3,3 -k4,4 ip.txt 求助Google得来 http://www.madboa.com/geek/sort-addr/
2009/5/12 明�X <[email protected]>: > 上网找C++库 :) > > 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 >> >> 谢谢! >> > > > > -- > 我的操作系�y是Gnu/Linux Debian/gNewSense Gnome Mozilla Gmail/Evolution > Gtkmm/Gtkglextmm Scim Totem Pidgin. > > > -- > To UNSUBSCRIBE, email to [email protected] > with a subject of "unsubscribe". Trouble? Contact [email protected] > > -- Best Regards, Alyex -- To UNSUBSCRIBE, email to [email protected] with a subject of "unsubscribe". Trouble? Contact [email protected]

