blob: b9ebbb32538fb915e3fc3f3b6c786aae4c8f617b [file] [log] [blame] [edit]
import sys
argv = sys.argv
assert len(argv) > 2, "usage: ./script.py filename cell1 cell2 ..."
filename = argv[1]
cells = argv[2:]
with open(filename) as f:
content = f.readlines()
prev_remove = False
remove = False
new_content = []
for line in content:
if line.startswith('X'):
for cell in cells:
if cell in line:
remove = True
elif line.startswith('+') and prev_remove:
remove = True
if not remove:
new_content.append(line)
else:
print("Removing:", line)
prev_remove = remove
remove = False
with open(filename, 'w') as f:
f.writelines(new_content)