summaryrefslogtreecommitdiff
path: root/tools/diff.py
blob: 667010bfda62b7038090e77c31372c7bffe1d4bf (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
import sys

if len(sys.argv) < 3:
    print("Find the items that are in file1 and not in file2")
    print("  Usage:")
    print("  python diff.py <file1> <file2>")
    exit(0)

f1 = sys.argv[1]
f2 = sys.argv[2]

f1_list = []
f1_fp = open(f1, "r")
f1_lines = f1_fp.readlines()

for line in f1_lines:
	line1 = line.rstrip().lstrip()
	f1_list.append(line1)

f2_list = []
f2_fp = open(f2, "r")
f2_lines = f2_fp.readlines()

for line in f2_lines:
	line1 = line.rstrip().lstrip()
	f2_list.append(line1)

diff = []
for i in f1_list:
	present = False
	for j in f2_list:
		if i == j:
			present = True
	if not present:
		diff.append(i)
		print(i)