Sample Header Ad - 728x90

Best way to group & count lines on stdin?

2 votes
1 answer
980 views
Since time immemorial I have used ... | sort | uniq -c | sort -nr to group & count input lines, to count how many of each line there is in the input. Is there any better way? Have I just picked up a bad habit? Is there a better way using standard unix tools that will be installed on Ubuntu Linux 18.04+ (or things that are an apt-get away?)
Asked by Amandasaurus (1336 rep)
Aug 14, 2020, 01:13 PM
Last activity: Dec 2, 2023, 11:31 AM