192. Word Frequency My Submissions Question Leetcode Bash
来源:互联网 发布:win7没有打印机usb端口 编辑:程序博客网 时间:2024/04/27 18:21
Write a bash script to calculate the frequency of each word in a text file words.txt
.
For simplicity sake, you may assume:
words.txt
contains only lowercase characters and space' '
characters.- Each word must consist of lowercase characters only.
- Words are separated by one or more whitespace characters.
For example, assume that words.txt
has the following content:
the day is sunny the thethe sunny is isYour script should output the following, sorted by descending frequency:
the 4is 3sunny 2day 1
Note:
Don't worry about handling ties, it is guaranteed that each word's frequency count is unique.
# Read from the file words.txt and output the word frequency list to stdout.grep -oE '[a-z]+' words.txt | sort | uniq -c | sort -r | awk '{print $2" "$1}'
0 0
- 192. Word Frequency My Submissions Question Leetcode Bash
- 【leetcode】100. Same Tree My Submissions Question
- Leetcode Sudoku Solver My Submissions Question
- LeetCode 36 Valid Sudoku My Submissions Question
- [leetcode][bash] Word Frequency
- [Leetcode] Minimum Window Substring My Submissions Question Solution
- 【leetcode】206. Reverse Linked List My Submissions Question
- 【leetcode】141. Linked List Cycle My Submissions Question
- 【leetcode】142. Linked List Cycle II My Submissions Question
- LeetCode#102. Binary Tree Level Order Traversal My Submissions Question
- leetcode 192. Word Frequency
- [Leetcode] 192. Word Frequency
- 292. Nim Game My Submissions Question
- 182. Duplicate Emails My Submissions Question
- leetcode283. [Array]Move Zeroes My Submissions Question
- leetcode70.[DP] Climbing Stairs My Submissions Question
- 112. Path Sum My Submissions Question
- leetcode-shell-192. Word Frequency
- Android-Android studio 出现 Error: NDK integration is deprecated in the current plugin. 问题解决
- AndroidStudio项目配置第三方libray库
- java 23种设计模式(二)
- VisualSvn Server安装和使用(转载)
- C#获取文件和文件夹大小
- 192. Word Frequency My Submissions Question Leetcode Bash
- WIFI基本知识整理
- AJAX、JSONP和CORS
- 闭包的实践
- JSP/servlet的对应
- Protocol Buffer技术详解(语言规范)
- java 23种设计模式(三)
- 深入浅出RxJava(一:基础篇)
- MYSQL 查询数据