您的位置:首页 > 运维架构 > Linux

【linux学习笔记】 sort

2013-11-18 15:12 274 查看
1.对用冒号:分隔的第二列升序排序:

Sort a colon delimited text file on 2nd field (employee_id):

$ sort -t: -k 2 employee.txt



2.对IP地址排序:

参考1:http://cosy.univ-reims.fr/~bhaggar/doc/Linux-101-Hacks.pdf

参考2:http://www.madboa.com/geek/sort-addr/



fields set apart from the others by a dot (-t .). Sort first by the first field, and
only the first field (-k 1,1), then by the second and only the second (-k
2,2), and so on (-k 3,3 -k 4,4).”
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: