tr命令我们很清楚,可以删除替换,删除字符串。 在英文中我们要经常会经常统计英文中出现的频率,如果用常规的方法,用设定计算器一个个算比较费事,这个时候使用tr命令,将空格分割替换为换行符,再用tr命令删除掉有的单词后面的点号,逗号,感叹号。先看看要替换的this.txt文件
The Zen of Python, by Tim Peters
Beautiful is better than ugly.
Explicit is better than implicit.
Simple is better than complex.
Complex is better than complicated.
Flat is better than nested.
Sparse is better than dense.
Readability counts.
Special cases aren't special enough to break the rules.
Although practicality beats purity.
Errors should never pass silently.
Unless explicitly silenced.
In the face of ambiguity, refuse the temptation to guess.
There should be one-- and preferably only one --obvious way to do it.
Although that way may not be obvious at first unless you're Dutch.
Now is better than never.
Although never is often better than *right* now.
If the implementation is hard to explain, it's a bad idea.
If the implementation is easy to explain, it may be a good idea.
Namespaces are one honking great idea -- let's do more of those!
上面的文本文件,如果要文中出现次数的最多的10个单词统计出来,可以使用下面的命令
[root@linux ~]# cat this.txt | tr ' ' '\n' | tr -d '[.,!]' | sort | uniq -c | sort -nr | head -10 10 is 8 better 8 than 5 to 5 the 3 of 3 Although 3 never 3 be 3 one
可谓非常方便!
总结
以上就是这篇文章的全部内容了,希望本文的内容对大家的学习或者工作具有一定的参考学习价值,谢谢大家对的支持。如果你想了解更多相关内容请查看下面相关链接
免责声明:本站文章均来自网站采集或用户投稿,网站不提供任何软件下载或自行开发的软件! 如有用户或公司发现本站内容信息存在侵权行为,请邮件告知! 858582#qq.com
更新日志
- 中国音乐地图之听见内蒙古呼麦短调2020[WAV分轨]
- 望江晴.2024-望【华纳】【FLAC分轨】
- 庞龙.2017-走着唱着【星外星】【WAV+CUE】
- 张秀卿.2000-却上心头【锐音音乐】【WAV+CUE】
- 中国音乐地图之听见新疆塔吉克族民间乐曲集2020[WAV+分轨]
- OrchestraOrfeo-RomanzaMusicforStringsbySibeliusBrittenBarberPrt(2024)[24Bit-96
- TheClevelandOrchestra-ProkofievSymphonyNo.6(2024)[24Bit-96kHz]FLAC
- 刘舸《我的寂寞像一条蛇》[320K/MP3][56.06MB]
- 刘舸《我的寂寞像一条蛇》[FLAC/分轨][125.49MB]
- 邓讴歌《三叉戟 电影配乐专辑》[320K/MP3][73.01MB]
- 尹光.2006-浓情香港半世纪2CD【环星】【FLAC分轨】
- 梁咏琪.2001-透明【EEI】【WAV+CUE】
- 齐秦.1989-金曲纪念辑【快乐唱片】【WAV+CUE】
- 群星-《情惹发烧情》HQCD【低速原抓WAV+CUE】
- 马健涛《你是我唯一的执着》限量1:1母盘直刻[低速原抓WAV+CUE]