#!/usr/bin/python3 import sys as isys with open('did') as logs: ln = 0 sys = 0 proc = 0 persistent = 0 for line in logs: ln += 1 splits = line.strip().split(' ') path = splits[-1] if path.startswith("/sys"): sys += 1 continue if path.startswith("/proc"): proc += 1 continue persistent += 1 print(f"{ln:>3}: {path}") # print to stderr so we can pipe the output to a file and extract the persistent deletions print(f"there were {sys} /sys files deleted", file=isys.stderr) print(f"there were {proc} /proc files deleted", file=isys.stderr) print(f"there were {persistent} persistent files deleted", file=isys.stderr) print(f"equalling {sys + proc + persistent} total files", file=isys.stderr)