#!/usr/bin/python import sys import string if __name__ == '__main__': fname = sys.argv[-1] # read the input file fdi = open(fname,'r') buff = fdi.readlines() output = [] for lb in buff: if len(lb) > 0 : if lb[0] == '/' or lb[0] == '!' : vals = string.split(lb) if vals[0].upper() == '/SOLU' : cpdel = "CPDEL,all,all\n" output.append(cpdel) cpcyc = "CPCYC,UY,0.001,1,0,90,0\n" output.append(cpcyc) output.append(lb) fdi.close() fdo = open(fname,'w') for lo in output: fdo.write("%s"%(lo)) fdo.close()