Input is this: SET1_S_W CHAR(1) NOT NULL, SET2_S_W CHAR(1) NOT NULL, SET3_S_W CHAR(1) NOT NULL, SET4_S_W CHAR(1) NOT NULL, ;
.py says: import re, string, sys s_ora = re.compile('.*S_W.*') lines = open("y.sql").readlines() for i in range(len(lines)): try: if s_ora.search(lines[i]): del lines[i] except IndexError: open("z.sql","w").writelines(lines) but output is: SET2_S_W CHAR(1) NOT NULL, SET4_S_W CHAR(1) NOT NULL, ; It should delete every, not every other! thx, RasDJ -- http://mail.python.org/mailman/listinfo/python-list