Created
February 6, 2013 13:32
-
-
Save AlexRezit/4722511 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
#!/usr/bin/python | |
import sys | |
import string | |
import re | |
word_separator = re.compile('(?:,|\n)') | |
filename = sys.argv[1] | |
filedata = open(filename).read() | |
lines = re.compile('\n').split(filedata) | |
words = word_separator.split(filedata) | |
for line in lines: | |
for comp in re.compile(',').split(line): | |
if not words.count(comp) > 1: | |
lines.remove(line) | |
break | |
print string.join(lines, '\n') | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment