Created
April 26, 2016 05:17
-
-
Save Felamande/31b2ebeb30a630b006cf5d93803309ab 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/env python3 | |
import sys | |
def intersect(fileset): | |
fset = set(open(fileset[0]).readlines()) | |
for f in fileset[2:]: | |
fd = open(f) | |
fset &= set(fd.readlines()) | |
# print(list(fset)) | |
return fset | |
def main(): | |
try: | |
inter = intersect(sys.argv[1:]) | |
except Exception as e: | |
print(e) | |
return | |
for line in list(inter): | |
print(line,end="") | |
if __name__ == '__main__': | |
sys.exit(int(main() or 0)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment