I have 2 text files and I want to compare content of one with another. Need to check ip in Unique.txt is present or not in CheckIp.txt. My code looks like:
with open("/root/nix_bsd_mac_inventory-master/Unique.txt") as fp:
for line in fp:
print(line)
with open("/root/nix_bsd_mac_inventory-master/CheckIp.txt") as fp1:
for line1 in fp1:
line1 = line1.rstrip()
if line == line1:
print (line1 + "Ip is Already Present")
else:
print ("Processing Ip:"+ line)
It seems something I am doing wrong. Can someone please help me?