Skip to content

Instantly share code, notes, and snippets.

@prashanta
Created June 2, 2010 04:54
Show Gist options
  • Save prashanta/421950 to your computer and use it in GitHub Desktop.
Save prashanta/421950 to your computer and use it in GitHub Desktop.
# Python script to find missing lines from two different files
import sys
import string
if len(sys.argv) < 4:
print "Usage: findmissing.py <master-file> <test-file> <result-file>"
sys.exit()
else:
file1 = sys.argv[1];
file2 = sys.argv[2];
fileout = sys.argv[3];
o = open(fileout,"w")
data1 = open(file1).readlines()
data2 = open(file2).readlines()
for x in data1:
l = len(data2)
i = 0
for y in data2:
i=i+1
if x == y:
o.write(x.rstrip("\n") + " ======= " + y.rstrip("\n") + "\n")
break
elif i == (l):
o.write(x.rstrip("\n") + " ------- NULL \n")
o.close()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment