歡迎來到Linux教程網
Linux教程網
Linux教程網
Linux教程網
Linux教程網 >> Linux基礎 >> Linux技術 >> LINUX——sort命令

LINUX——sort命令

日期:2017/3/3 12:38:43   编辑:Linux技術

sort是實現文本內容排序的command

[code]cat test:

[code]cat test|sort:
將第一個字符排序

[code]cat test|sort -r(reverse)
降序排序

[code]cat test|sort -t ":" -k 2
將test按“:”為分隔符然後取出第二個字段來排序

[code]cat test|sort -n
將文件用數字大小來排序

[code]cat test|sort -u
去掉重復行(unique命令也可以去掉重復行)

Copyright © Linux教程網 All Rights Reserved