美文网首页
bash题目汇总

bash题目汇总

作者: cornbig | 来源:发表于2021-02-20 11:22 被阅读0次

1.统计词频:
写一个 bash 脚本以统计一个文本文件 words.txt 中每个单词出现的频率。

为了简单起见,你可以假设:

words.txt只包括小写字母和 ' ' 。
每个单词只由小写字母组成。
单词间由一个或多个空格字符分隔。

the day is sunny the the
the sunny is is

the 4
is 3
sunny 2
day 1
code

cat word.txt | tr -s " "  "\n"| sort | uniq -c| sort -r| awk '{print $2, $1}'

过程
(1).cat word txt
(2). cat word.txt | tr -s " " "\n" 空格变换为换行



(3).排序sort



(3).统计词频

(4).统计词频 倒序sort,并awk 打印,

相关文章

  • bash题目汇总

    1.统计词频:写一个 bash 脚本以统计一个文本文件 words.txt 中每个单词出现的频率。 为了简单起见,...

  • Bash 注入分析及奇技淫巧总结

    平台 : 题目简介 : Bash Jail 1 解法汇总 :

  • LeetCode 477 Total Hamming Dista

    LeetCode 排列组合 题目汇总LeetCode 数字 题目汇总LeetCode 动态规划 题目分类汇总干货!...

  • LeetCode 473 Matchsticks to Squa

    LeetCode 排列组合 题目汇总LeetCode 数字 题目汇总LeetCode 动态规划 题目分类汇总干货!...

  • LeetCode 401 Binary Watch

    LeetCode 排列组合 题目汇总LeetCode 数字 题目汇总LeetCode 动态规划 题目分类汇总干货!...

  • LeetCode 461 Hamming Distance

    LeetCode 排列组合 题目汇总LeetCode 数字 题目汇总LeetCode 动态规划 题目分类汇总干货!...

  • 题目汇总

    HTML的 Doctype 作用 ? 严格模式与混杂模式如何区分?它们有何意义 ? 1. 声...

  • 题目汇总

    1,一篇关于梦的文章 2,让小孩子失望的文章 3,字幕的力量 电影,训龙高手,弱点,怦然心动,青春珊瑚岛

  • 日常出错总结

    mac 电脑安装文件相关错误汇总 1. -bash:easy_install: command not found...

  • [南邮OJ](Web)综合题

    题目链接: 综合题 300题目地址:tip:bash 分析:打开题目提供链接 : 明显 JSF*ck 编码 , 使...

网友评论

      本文标题:bash题目汇总

      本文链接:https://www.haomeiwen.com/subject/doutfltx.html