One - One Code All

Blog Content

linux Shell sort按照指定列排序

Linux-Mac 运维   2009-09-19 15:38:58

sort -t”,” -k 1n,1 -k 3rn,3 file.txt


结果说明:

1.-t 指定文本分隔符

2.-k 指定排序列

3.-n 按数字进行排序

4.-r 翻转排序结果


上面的例子为按第一行正排序,按第三行反排序。



上一篇:cat 显示指定行
下一篇:如何在多重引号里面取到shell变量的值?

The minute you think of giving up, think of the reason why you held on so long.