shell脚本,按单词出现频率降序排序。

[root@localhost oldboy]# cat file
the squid project provides a number of resources toassist users design,implement and support squid installations. Please browsethe documentation and support sections for more infomation
[root@localhost oldboy]# cat 96.sh 
#!/bin/bash
                            
echo `cat file|xargs -n1 | sort | uniq -c|sort -nr`

[root@localhost oldboy]# bash 96.sh 
2 support 2 squid 2 and 1 users 1 toassist 1 the 1 sections 1 resources 1 provides 1 project 1 Please 1 of 1 number 1 more 1 installations. 1 infomation 1 for 1 documentation 1 design,implement 1 browsethe 1 a
[root@localhost oldboy]# 

 

posted on 2016-09-06 18:16  王月波  阅读(598)  评论(0)    收藏  举报

导航