Today I Learned

hashrocket A Hashrocket project

Counting occurrences in shell

Today I learned that uniq has an -c option that counts the number of times the line occurred and prepends for each uniq result. That's very handy tool:

$ echo "foo\nfoo\nbar\nfoo" | sort | uniq -c
   1 bar
   3 foo
See More #command-line TILs