May-29-2021, 10:00 PM
Greetings!
I'm trying to find lines from one file in another file.
I have to do that by matching timestamp.
Lines look like this:
File 1
for some reason, I cannot print lines that are not in both files.
Here is a code I got:
I'm trying to find lines from one file in another file.
I have to do that by matching timestamp.
Lines look like this:
File 1
\\D1376\d$\logs\BBLog.100.xml,05/13/2021 00:01:23 \\D1376\d$\logs\BBLog.11.xml,05/27/2021 15:11:03 \\D1376\d$\logs\BBLog.1.xml,05/28/2021 17:02:03 \\D1376\d$\logs\BBLog.10.xml,05/27/2021 15:22:15File 2
\\D1376\d$\logs\BBLog.100.xml,05/13/2021 00:01:23 \\D1376\d$\logs\BBLog.11.xml,05/27/2021 15:11:03 \\D1376\d$\logs\BBLog.1.xml,05/29/2021 18:04:02 \\D1376\d$\logs\BBLog.10.xml,05/29/2021 17:02:11I have to split lines in File-1 and use split elements to match lines in File-2.
for some reason, I cannot print lines that are not in both files.
Here is a code I got:
tod1376 = 'C:\\01\\fileD1376.txt' yrd1376 = open ('C:\\02\\fileY1376.txt','r') yrd = yrd1376.readlines() with open (tod1376,'r') as tod : for lntod in tod : lntod=lntod.strip() *whocares,sp_lntod = lntod.split(",") sp_EL1 = sp_lntod sp_EL1=str(sp_EL1).strip() for lnyrd in yrd : lnyrd=lnyrd.strip() found = re.search(sp_EL1,lnyrd) print(f" Fund matched- -{lntod}") if not found : print(f" Not Matched ++ {lntod}")Thank you!