Shell 命令实现词频统计
2016-03-22 09:46
417 查看
杨贵福老师的方法
cat tr sed sort head 命令的综合使用方式1$ cat pg11.txt |tr -cs A-Za-z\' '\n' |sed "/'/d"| tr A-Z a-z | sort|uniq -c |sort -k1,1nr -k2 | head
结果为:
1797 the 884 and 804 to 679 a 619 of 537 she 515 it 462 said 423 in 395 you
\2. cat tr sed sort head 命令的综合使用方式2 (PS:刚刚加了sed这一条,用于删除 ' 这个被匹配的单词)
$ cat pg11.txt |tr -cs A-Za-z\' '\n' | tr A-Z a-z | sort|uniq -c |sort -k1,1nr -k2 | head
结果为:
1797 the 884 and 804 to 679 a 619 of 537 she 515 it 462 said 423 in 395 you
相关文章推荐
- windows下cmd shell 配置的刷新
- Linux服务器登录后显示"-bash-4.1$"
- bash
- Bash变量
- Shell登陆
- shell数组
- sed && awk工具 及一些常用的shell脚本
- Shell流程控制
- Shell 编程基础 --语法快速入门
- 学习笔记之Linux Shell脚本教程:30分钟玩转Shell脚本编程
- shell EOF 用户自定义终止符
- 阿里云 2016 实习生一、二面
- Shell常用命令整理
- Shell 命令--文件创建、搜索命令--总结自《Linux Shell 脚本攻略》
- mac bash_profile 配置(backup使用)
- Powershell foreach
- shell--5--传递参数
- shell中比较字符串大小,>和<前需要加上\进行转义,否则会输出到文件了
- powershell脚本闪电输入神器
- shell 排序