[Leetcode Shell]Word Frequency
2015-04-02 14:32
85 查看
Leetcode shell部分的词频统计 要求统计文本中单词出现次数,最后要按次数排序。
awk 'BEGIN{RS=""}{for(i=1;i<=NF;i++){w[$i]+=1}}END{for(a in w) print a" "w[a]}' words.txt | sort -rnk2
Shell实践不足 正好练手。
awk 'BEGIN{RS=""}{for(i=1;i<=NF;i++){w[$i]+=1}}END{for(a in w) print a" "w[a]}' words.txt | sort -rnk2
Shell实践不足 正好练手。
相关文章推荐
- Leetcode: Word Frequency (shell , awk)
- leetcode-shell-192. Word Frequency
- leetcode-shell-194. Transpose File
- [leetcode][bash] Word Frequency
- LeetCode:Shell题目
- leetcode-shell-195. Tenth Line
- 【Leetcode Shell】Transpose File
- Leetcode: Word Frequency
- LeetCode Shell
- leetcode192. Word Frequency
- leetcode 新题型----SQL,shell,system design
- 【leetcode-shell】Tenth Line
- LeetCode 195. Tenth Line (shell)
- [Leetcode Shell] Transpose File
- [LeetCode] Word Frequency 单词频率
- Leetcode: Transpose File (shell, awk)
- 【Leetcode Shell】Tenth Line
- [leetcode]Word Frequency
- leetcode 新题型----SQL,shell,system design
- LeetCode Shell Problems