Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to sort and count occurrence of lines in linux [duplicate]

How I can count occurence results of list in linux?

a
b
b
c
c
d

Result: a = 1 , b = 2 , c=2 , d=1
like image 400
kakashy Avatar asked Dec 15 '22 13:12

kakashy


1 Answers

I solved this by piping to this command

sort | uniq -c 
like image 129
kakashy Avatar answered Feb 13 '23 23:02

kakashy