da mir letztes mal schon super hier geholfen wurde, versuche ich es noch mal

Ich möchte ein Programm schreiben welches eine log Datei ausließt und mir nur bestimmte Informationen zurückgibt.
Ein Teil meiner Log Datei:
Immer zwei Einträge gehören zusammen. also z.B. :Name5/0/2 is up, line protocol is up (verbunden)
Letzter input 00:01:33, output 00:00:06, abc abc abc
Name5/0/2 is down, line protocol is down (getrennt)
Letzter input 20w0d, output 20w0d, abc abc abc
Name5/0/3 is down, line protocol is down (getrennt)
Letzter input never, output never, abc abc abc
Name4/0/4 is down, line protocol is down (getrennt)
Letzter input never, output never, abc abc abc
Name3/0/5 is down, line protocol is down (getrennt)
Letzter input never, output never, abc abc abc
Name2/0/8 is down, line protocol is down (getrennt)
Letzter input 18:30:15, output 18:29:38, abc abc abc
Name1/0/9 is up, line protocol is up (verbunden)
Letzter input 1w2d, output 00:00:06, abc abc abc
Name2/0/10 is up, line protocol is up (connected)
Letzter input 00:00:41, output 00:00:06, abc abc abc
Name3/0/2 is down, line protocol is down (getrennt)
Letzter input 20w0d, output 20w0d, abc abc abc
Name1/0/11 is administratively down, line protocol is down (getrennt)
Letzter input never, output never, abc abc abc
Name2/0/22 is down, line protocol is down (getrennt)
Letzter input 2d21h, output 2d20h, abc abc abc
Name1/1/1 is down, line protocol is down (getrennt)
Letzter input never, output never, abc abc abc
Folgendes Programm löscht mir alle Einträge die "up" sind und schreibt sie mir in eine neue Datei :Name5/0/2 is up, line protocol is up (verbunden)
Letzter input 00:01:33, output 00:00:06, abc abc abc
Code: Alles auswählen
with open("D:\Programm\Auswertung.txt", encoding="utf8") as zeilen:
daten = []
skip_next = False
for zeile in zeilen:
if skip_next:
skip_next = False
else:
teile = zeile.split(" ")
if "up" in teile[2]:
skip_next = True
else:
daten.append(teile)
with open("D:\Programm\Ergebniss.txt",'w') as ergebniss:
for item in daten:
ergebniss.write("%s\n" % item)
Nun möchte ich aber noch alle Einträge löschen :
Deren Letzter Input vor weniger als 10 Wochen war , also z.B. diesen :
da es im log aber als Zeitangabe d, w oder auch eine Uhrzeit sein kann, habe ich keine Ahnung wie ich dies tun soll.Name2/0/22 is down, line protocol is down (getrennt)
Letzter input 2d21h, output 2d20h, abc abc abc