Created
June 2, 2010 04:54
-
-
Save prashanta/421950 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
# 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