# logcount.py import re pat = re.compile(r' /(..)/00Latest.jpg .* 200 ') count = {} for s in file('/net/fs/home0/isstaff/tkikuchi/da/wx.log'): m = pat.search(s) if m: d = m.group(1) if count.has_key(d): count[d] += 1 else: count[d] = 1 t = [(count[k], k) for k in count.keys()] t.sort() t.reverse() for x in t: print '%s %4d' % (x[1], x[0])