import re from collections import Counter with open("/home/prathiyuman/Prathiyuman/ContecMonitor/fiveparaminte-main/hl7_forwarder.log", "r") as f: content = f.read() warnings = re.findall(r"unrecognized. Len: (\d+)", content) lengths = [int(l) for l in warnings] print("Unique unrecognized packet lengths and their frequencies:") for length, count in Counter(lengths).most_common(): print(f" Length {length}: {count} times")