How can we sort uniq lines in a file?

cat fruits.txt | sort | uniq -c | sort -nk1

What is the purpose of the -n option for the sort command?

The -n option tell sort to sort numerically.

Unless otherwise stated, the content of this page is licensed under Creative Commons Attribution-ShareAlike 3.0 License