国产成人精品18p,天天干成人网,无码专区狠狠躁天天躁,美女脱精光隐私扒开免费观看

linux中如何使用tr命令統計英文單詞出現頻率

發(fā)布時(shí)間:2021-09-14 18:13 來(lái)源:億速云 閱讀:0 作者:小新 欄目: 服務(wù)器 歡迎投稿:712375056

這篇文章主要介紹linux中如何使用tr命令統計英文單詞出現頻率,文中介紹的非常詳細,具有一定的參考價(jià)值,感興趣的小伙伴們一定要看完!

tr命令我們很清楚,可以刪除替換,刪除字符串。 在英文中我們要經(jīng)常會(huì )經(jīng)常統計英文中出現的頻率,如果用常規的方法,用設定計算器一個(gè)個(gè)算比較費事,這個(gè)時(shí)候使用tr命令,將空格分割替換為換行符,再用tr命令刪除掉有的單詞后面的點(diǎn)號,逗號,感嘆號。先看看要替換的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個(gè)單詞統計出來(lái),可以使用下面的命令

[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

免責聲明:本站發(fā)布的內容(圖片、視頻和文字)以原創(chuàng )、來(lái)自本網(wǎng)站內容采集于網(wǎng)絡(luò )互聯(lián)網(wǎng)轉載等其它媒體和分享為主,內容觀(guān)點(diǎn)不代表本網(wǎng)站立場(chǎng),如侵犯了原作者的版權,請告知一經(jīng)查實(shí),將立刻刪除涉嫌侵權內容,聯(lián)系我們QQ:712375056,同時(shí)歡迎投稿傳遞力量。

色在线亚洲视频www| 日本老妇人乱XXY| 亚洲AV综合色区无码二区偷拍| 亚洲国产欧美人成| 成人网站免费大全日韩国产| 特级做A爰片毛片免费看|