sort
man - sort lines of text files
将文本按行进行排序
默认大写字母在小写字母后面
文本内容输出排序
sort out.txt // 将out.txt内容输出并排序
sort -u out.txt // 去重
反序排序
sort -r out.txt
字符串中间的数字排序
[root@localhost ~]# sort -nk 2 -t: text
13dian:0
38nv:0
Yin:0
yin:1
wen:2
jian:14
Wen:484
[root@localhost ~]# sort -n text
jian:14
wen:2
Wen:484
Yin:0
yin:1
13dian:0
38nv:0
-n:按数字大小排列
-t:指定分隔符-t:表示已:为符号将字符串分割为不同栏目
-k:指定用第几栏目的值进行排列
2076

被折叠的 条评论
为什么被折叠?



