#!/usr/bin/env python import re, sys infile = file('workingon.nec', 'r') outfile = file('secondgood.nec', 'w') for line in infile: if(line[0:2] == 'GW'): (f1, num, x1, y1, z1, x2, y2, z2) = re.split('\s+', line)[1:9] if(x1[0] != '-' and y1[0] == '-' and z1[0] != '-' and x2[0]!= '-' and y2[0]!='-' and z2[0]!='-'): y1='0' line = "GW %s %s %s %s %s %s %s %s 0.001\n" % (f1, num, x1, y1, z1, x2, y2, z2) sys.stdout.write('*') outfile.write(line) elif(x1[0] == '-' or y1[0] == '-' or z1[0] == '-' or x2[0]== '-' or y2[0]=='-' or z2[0]=='-'): sys.stdout.write('.') else: outfile.write(line) sys.stdout.write('+') print ""