Skip to content

Instantly share code, notes, and snippets.

@Felamande
Created April 26, 2016 05:17
Show Gist options
  • Save Felamande/31b2ebeb30a630b006cf5d93803309ab to your computer and use it in GitHub Desktop.
Save Felamande/31b2ebeb30a630b006cf5d93803309ab to your computer and use it in GitHub Desktop.
#!/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