[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

How to sort and count efficiently?

From: Peng Yu
Subject: How to sort and count efficiently?
Date: Sun, 30 Jun 2019 07:34:19 -0500


I have a long list of string (each string is in a line). I need to
count the number of appearance for each string.

I currently use `sort` to sort the list and then use another program
to do the count. The second program doing the count needs only a small
amount of the memory as the input is sorted.

But `sort` writes a lot of temp files like `sortjISjDY`, which are
very large. Because I only need the count, ideally, I'd like these
temp files only keep the count info and the original string once, but
not the original string many times. Does anybody know any better way
to make the sort and count run more efficiently?


reply via email to

[Prev in Thread] Current Thread [Next in Thread]