Created
January 28, 2015 00:14
-
-
Save peterbe/b857c7329ac23bef768d to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import sys | |
logfile = sys.argv[1] | |
from collections import defaultdict | |
inserts = defaultdict(int) | |
for line in open(logfile): | |
inserts[line.strip()] += 1 | |
items = [(v,k) for (k,v) in inserts.items()] | |
total = sum(x[0] for x in items) | |
items.sort() | |
items.reverse() | |
for times, query in items[:20]: | |
print str(times), query[:100] | |
print "TOTAL", total |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment