#!/usr/bin/python

# see http://stackoverflow.com/questions/1523427/python-what-is-the-common-header-format
__author__ = "Stefan Beller"
__copyright__ = "Copyright 2013"
__license__ = "GPL 3 or later"
__version__ = "0.1"
__email__ = "stefanbeller@googlemail.com"
__status__ = "Production"

import operator

f = open("athena.txt","r")
lines = f.readlines()
v = {}
for line in lines:
        a = line.split("\t")
        if len(a) > 17:
                questvarstring = a[18]
                questvars = questvarstring.split(" ")
                for q in questvars:
                        varname = q.split(',')[0]
                        if varname == "":
                                continue
                        if varname in v:
                                v[varname] += 1
                        else:
                                v[varname] = 1

sortedv = sorted(v, key=v.get)
for vv in sortedv:
        print vv, v[vv]


