import re
import os
import sys
for fn in os.listdir("."):
  p = os.path.splitext(fn)
  if p[1] == ".pbm":
    content = b""
    with open(fn, "rb") as f:
      content = f.read()
    content = re.sub(b"#.*\n", b"", content)
    with open(fn, "wb") as f:
      f.write(content)
