Skip to content

Instantly share code, notes, and snippets.

@AlexeyMK
Created October 6, 2011 08:05
Show Gist options
  • Save AlexeyMK/1266808 to your computer and use it in GitHub Desktop.
Save AlexeyMK/1266808 to your computer and use it in GitHub Desktop.
sponsor filterer
# IE, resume_filter.py resumes.tsv 10gen mongodb mongo
# creates 10gen.tsv, which has all participants who mentioned they were
# excited about 10gen (however they called it) and removes the last column
# (which lists companies that participants are interested in)
import fileinput
from sys import argv
sponsor_names = argv[2:]
output = file(argv[2] + ".tsv", 'w')
reading_from = fileinput.input(argv[1])
#copy over line with headers and stuff
output.write(reading_from.readline())
for line in reading_from: #argv[1]
if any(sponsor in line or sponsor.capitalize() in line for sponsor in sponsor_names):
#magic-ass shit that gets rid of the last column
output.write("\t".join(line.split('\t')[:-1]) + "\n")
output.close()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment