校园春色亚洲色图_亚洲视频分类_中文字幕精品一区二区精品_麻豆一区区三区四区产品精品蜜桃

主頁 > 知識庫 > tr命令在統(tǒng)計英文單詞出現(xiàn)頻率中的妙用

tr命令在統(tǒng)計英文單詞出現(xiàn)頻率中的妙用

熱門標簽:菏澤crm外呼系統(tǒng)價格 申請400電話號碼多少錢 物超所值的400電話申請 營銷電銷機器人招商 百應電銷機器人靠譜嗎 遼寧電銷平臺外呼系統(tǒng)軟件 如何在各種地圖標注自己的地址 信陽銷售外呼系統(tǒng)招商 coreldraw地圖標注

tr命令我們很清楚,可以刪除替換,刪除字符串。 在英文中我們要經(jīng)常會經(jīng)常統(tǒng)計英文中出現(xiàn)的頻率,如果用常規(guī)的方法,用設定計算器一個個算比較費事,這個時候使用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!

上面的文本文件,如果要文中出現(xiàn)次數(shù)的最多的10個單詞統(tǒng)計出來,可以使用下面的命令

[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

可謂非常方便!

總結(jié)

以上就是這篇文章的全部內(nèi)容了,希望本文的內(nèi)容對大家的學習或者工作具有一定的參考學習價值,謝謝大家對腳本之家的支持。如果你想了解更多相關(guān)內(nèi)容請查看下面相關(guān)鏈接

標簽:內(nèi)江 湖北 廈門 泰安 瀘州 玉樹 江門 江西

巨人網(wǎng)絡通訊聲明:本文標題《tr命令在統(tǒng)計英文單詞出現(xiàn)頻率中的妙用》,本文關(guān)鍵詞  命令,在,統(tǒng)計,英文,單詞,;如發(fā)現(xiàn)本文內(nèi)容存在版權(quán)問題,煩請?zhí)峁┫嚓P(guān)信息告之我們,我們將及時溝通與處理。本站內(nèi)容系統(tǒng)采集于網(wǎng)絡,涉及言論、版權(quán)與本站無關(guān)。
  • 相關(guān)文章
  • 下面列出與本文章《tr命令在統(tǒng)計英文單詞出現(xiàn)頻率中的妙用》相關(guān)的同類信息!
  • 本頁收集關(guān)于tr命令在統(tǒng)計英文單詞出現(xiàn)頻率中的妙用的相關(guān)信息資訊供網(wǎng)民參考!
  • 推薦文章
    主站蜘蛛池模板: 博湖县| 思南县| 普格县| 拜泉县| 长葛市| 镇宁| 内丘县| 慈利县| 鄂伦春自治旗| 藁城市| 灵石县| 平舆县| 绵阳市| 乐昌市| 株洲市| 双柏县| 英山县| 灯塔市| 平定县| 八宿县| 普兰县| 禹州市| 静宁县| 禹州市| 惠东县| 三台县| 麟游县| 玉溪市| 临邑县| 会宁县| 嵊州市| 平果县| 安远县| 普安县| 白朗县| 翼城县| 江川县| 临颍县| 永善县| 自治县| 阿鲁科尔沁旗|