linux系统中统计文本中单词出现的次数

时间:2021-04-21 16:09:05   收藏:0   阅读:28

 

 

1、测试数据

[root@PC3 test]# cat a.txt
e i e s
d e t q
s g e g

 

2、

[root@PC3 test]# cat a.txt
e i e s
d e t q
s g e g
[root@PC3 test]# sed s/ /\n/g a.txt
e
i
e
s
d
e
t
q
s
g
e
g
[root@PC3 test]# sed s/ /\n/g a.txt | sort | uniq -c
      1 d
      4 e
      2 g
      1 i
      1 q
      2 s
      1 t

 

原文:https://www.cnblogs.com/liujiaxin2018/p/14684703.html

评论(0
© 2014 bubuko.com 版权所有 - 联系我们:wmxa8@hotmail.com
打开技术之扣,分享程序人生!