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
原文地址:https://www.cnblogs.com/Searchor/p/13207544.html