sort

1323
3245
2110
926
875

按字母比较大小
对inputfile内容按行排序,结果输出到output,默认升序
sort -o output.txt inputfile.txt
13,2,3
21,1,0
32,4,5
8,7,5
9,2,6

按数值比较大小
sort -k 1n  inputfile.txt
8,7,5
9,2,6
13,2,3
21,1,0
32,4,5

指定分隔符,按数值第2列排序
sort -t , -k 2n  inputfile.txt
21,1,0
13,2,3
9,2,6
32,4,5
8,7,5

 

posted @ 2020-06-29 13:34  fndefbwefsowpvqfx  阅读(98)  评论(0编辑  收藏  举报