摘抄自Letcode
文本内容
脚本
# xarhs -n 1 每个单词逐行显示
# uniq -c 去重并且输入记录次数
# sort -n 排序 -r相反的顺序进行排序
# 分析文本内容 分别输出文本中的第二项 第一项内容
$ cat words.txt|xargs -n 1 echo|uniq -c |sort -n -r |awk '{print $2,$1}'
输出结果如下:
摘抄自Letcode
# xarhs -n 1 每个单词逐行显示
# uniq -c 去重并且输入记录次数
# sort -n 排序 -r相反的顺序进行排序
# 分析文本内容 分别输出文本中的第二项 第一项内容
$ cat words.txt|xargs -n 1 echo|uniq -c |sort -n -r |awk '{print $2,$1}'
输出结果如下:
相关文章: