【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
![](http://img.blog.csdn.net/20131118150912203?watermark/2/text/aHR0cDovL2Jsb2cuY3Nkbi5uZXQvd3VzdW9wdUJVUFQ=/font/5a6L5L2T/fontsize/400/fill/I0JBQkFCMA==/dissolve/70/gravity/SouthEast)
2.对IP地址排序:
参考1:http://cosy.univ-reims.fr/~bhaggar/doc/Linux-101-Hacks.pdf
参考2:http://www.madboa.com/geek/sort-addr/
![](http://img.blog.csdn.net/20131118151118343?watermark/2/text/aHR0cDovL2Jsb2cuY3Nkbi5uZXQvd3VzdW9wdUJVUFQ=/font/5a6L5L2T/fontsize/400/fill/I0JBQkFCMA==/dissolve/70/gravity/SouthEast)
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).”
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).”
相关文章推荐
- Linux之ubuntu学习笔记(八):linux下的功能指令( find , locate , grep , cut , sort , head , tail,type,which..
- 【linux学习笔记】sort|uniq | cut | wc (我的第一篇markdown笔记)
- 写得蛮好的linux学习笔记[转]
- python 制作图表 matplotlib - 千月的python linux 系统管理指南学习笔记(18)
- [Linux内存]slab分配器学习笔记(二)--slab着色
- 鸟叔Linux学习笔记:第二章 主机规划与磁盘分区
- linux getopts 学习笔记
- 《Unix & Linux 大学教程》 - 第二十五章 学习笔记
- linux学习笔记(1)-Vim编辑器
- Linux用户和组管理内容---学习笔记
- Linux学习笔记之基本概念文件系统分区和挂载
- Linux 学习笔记_12_文件共享服务_3_NFS网络文件服务
- Linux内存管理学习笔记——内存寻址
- Linux系统学习笔记网络相关 ,firewalld和netfilter,netfilter5表5链介绍,iptables语法
- Linux学习之道:Linux Shell学习笔记
- Linux学习笔记(五)——Linux系统管理
- linux基础学习笔记(一)
- Linux程序设计学习笔记----多线程编程线程同步机制之互斥量(锁)与读写锁
- linux基础笔记和linux学习笔记好的网站