How to find the most popular word in a text file through the linux terminal? Need to write a script
Asked
Active
Viewed 166 times
-2
-
3Use sed, sort, uniq, head commands. – Ipor Sircer Nov 30 '17 at 04:52
-
1https://superuser.com/questions/661661/listing-all-words-in-a-text-file-and-finding-the-most-frequent-word – AsenM Nov 30 '17 at 08:07
1 Answers
1
This has been answered many times, please use search next time.
tr -c '[:alnum:]' '[\n*]' < test.txt | sort | uniq -c | sort -nr | head -10

AsenM
- 568