releasing package jabref version 2.10~beta1+ds-2
[debian/jabref.git] / combineJournalLists.py
1 #!/usr/bin/python
2
3 # Python script for combining several journal abbreviation lists
4 # and producing an alphabetically sorted list. If the same journal
5 # names are repeated, only the version found last is retained.
6 #
7 # Usage: combineJournalLists.py outfile infile1 infile2 ...
8
9 import sys
10 import fnmatch
11 import os
12
13 outFile = sys.argv[1]
14 dictionary = dict()
15 for i in range(2,len(sys.argv)):
16     count = 0
17     f = open(sys.argv[i], "r")
18     for line in f:
19         if line[0] != "#":
20             count = count+1
21             parts = line.partition("=")
22             dictionary[parts[0].strip()] = line.strip()
23     f.close()
24     print sys.argv[i]+": "+str(count)
25
26 print "Combined key count: "+str(len(dictionary))
27
28 f = open(outFile, "w")
29 for key in sorted(dictionary.iterkeys()):
30       f.write(dictionary[key]+"\n")
31 f.close()