1. 需求
用Shell处理以下的内容:
the squid project provides a number of resources to assist users design,implement and support squid installations. Please browse the documentation and support sections for more infomation,by theshu training.
要求:
- 按单词出现的频率降序排序
- 按字母出现的频率降序排序
提示:这道题适合用awk进行处理。
2. 数据准备
|
|
3. 参考脚本
3.1. 按单词出现频率降序排序的参考脚本
3.1.1. 方法1:awk数组法
|
|
3.1.2. 方法2:sort排序法
|
|
3.1.3. 方法3:tr配合awk数组法
|
|
3.2. 按字母出现频率降序排序的参考脚本
3.2.1. 方法1:awk数组法
|
|
3.2.2. 方法2:grep及sort排序法
|
|