How to do natural sort output of “uniq -c” in descending/acsending order? – unix
Use -n in your sort command, so that it sorts numerically. Also -r allows you to reverse the result: $ sort test.txt | uniq -c | sort -n 1 ada 1 ccd 1 cd 1 nnaa 2 aaa 2 bbb 4 aa 10 naa $ sort test.txt | uniq -c | sort -nr 10 naa … Read more