by vlovich123 · 1y ago · 0 comments
$ echo c a b c | tr ' ' '\n'
c
a
b
c
$ echo c a b c | tr ' ' '\n' | sort
a
b
c
c
$ echo c a b c | tr ' ' '\n' | sort | uniq -c
1 a
1 b
2 c
$ echo c a b c | tr ' ' '\n' | sort | uniq -c | sort -rn
2 c
1 b
1 a sort | uniq -c | sort -n
The second sort is sorting by frequency (the count output by `uniq -c`).