Sort and Unique in Shell
Level 241 keystrokes
Counts how many times each name appears in names.txt and lists the most frequent names first.
Shell code
# sort groups identical names, because uniq only merges adjacent duplicates# uniq -c prefixes each name with its count; sort -rn puts the largest count first1cat names.txt | sort | uniq -c | sort -rnOutput
5 Alice
3 Bob
2 Carol
1 DanPractice typing this code. Results are not recorded in the rankings.
Symbols in this code
The symbols you type in this Shell code and how often they appear.
|× 3-× 2.× 1