sort排序命令
作者:
w_dll | 来源:发表于
2019-08-01 22:28 被阅读0次
参考链接
1去重复 -u
#cat 1.txt
apple
banana
orange
pear
pear
#sort -u 1.txt
apple
banana
orange
pear
2排序 按照数字 -n、逆序-r
#cat 1.txt
1
3
5
2
7
9
6
#sort -nr 1.txt
9
7
6
5
3
2
1
3将结果写回原文件 -o
#sort 1.txt -o 1.txt
#cat 1.txt
1
2
3
5
6
7
9
4根据指定符号分割 -t 指定列来排序-k
# cat facebook.txt
banana:30:5.5
apple:10:2.5
pear:90:2.3
orange:20:3.4
# sort -n -k 2 -t : facebook.txt
apple:10:2.5
orange:20:3.4
banana:30:5.5
pear:90:2.3
4 不区分大小写 -f、忽略每行开头空白-b
本文标题:sort排序命令
本文链接:https://www.haomeiwen.com/subject/pyshdctx.html
网友评论