Last active
August 29, 2015 14:18
-
-
Save nothingrealhappen/2f3e8e37b4926b9f8b12 to your computer and use it in GitHub Desktop.
【每日一题】2015年3月31日
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.For example, assume that
words.txt
has the following content:Your script should output the following, sorted by descending frequency:
Note:
Don't worry about handling ties, it is guaranteed that each word's frequency count is unique.
Hint:
Could you write it in one-line using Unix pipes?