Skip to content

Instantly share code, notes, and snippets.

@cristobal
Created October 15, 2014 08:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save cristobal/64b6bff1a36305a767da to your computer and use it in GitHub Desktop.
Save cristobal/64b6bff1a36305a767da to your computer and use it in GitHub Desktop.
Diff lines from file a and b, all lines from b that are not in a will be displayed
#!/usr/bin/env python
import sys
def get_tokens(src):
file = open(src)
return [token.strip(' \t\n\r') for token in file.readlines()]
def diff_tokens(a, b):
return [x for x in a if x not in b]
def main():
a = get_tokens(sys.argv[1])
b = get_tokens(sys.argv[2])
tokens = diff_tokens(a, b)
for token in tokens:
print "%s" % token
if __name__ == "__main__":
main()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment