#!/usr/bin/env python # $Id: convert.py,v 1.1 2005/11/02 07:09:18 bvowk Exp $ import os import re import sys import commands hill_dir = "hill" tmp_dir = "convert.tmp" cmd_str = "pmars -r 0" def main(): files = os.listdir(hill_dir) os.mkdir(tmp_dir) for file in files: cmd = "%s %s/%s" % (cmd_str, hill_dir, file) out = commands.getoutput(cmd) outfile = open("%s/%s" % (tmp_dir, file), "w") for line in out.split("\n"): if re.compile(".+(assert|arning).+").match(line) or \ re.compile("Program").match(line): continue outfile.write(line) outfile.write("\n") outfile.close() os.rename(hill_dir, "%s.old" % hill_dir) os.rename(tmp_dir, hill_dir) main()