#!/bin/python3 import os import string import re import subprocess import gzip result = subprocess.run(['find /home/cod2/logs/archived_game_logs -iname "game*gz"'], shell=True, capture_output=True, text=True) filelist = result.stdout.splitlines() for file in filelist: first=False #true if the first date has been grabbed for this file. with gzip.open(file, 'rt', encoding="cp1252",newline="\n") as f: data = f.read() for i in data: #process each line, look for data worth having. line_space=i.split(" ") line_space_qty=len(line_space) line_backslash=i.split('\\') line_backslash_qty=len(line_backslash) #need to calculate current time from the timestamp, which is in the InitGame #NOTE that the server can restart with a log, so if the startup time changes #then it needs to be restarted, otherwise increment the seconds from the left of the log file