Why is it so hard to do sed like operation in Python?
cat temp$$ | sed '/ENTRY/d' | sed '/VERSION/d' > temp$$1
The following attempt simply doesn’t work (instead of writing to file I’m printing to screen):
70 for line in open("temp5027", 'r'):
71
72 if re.search("ENTRY|VERSION", line) != None:
73 pass
74 else:
75 print line
A frustrated first time python user.
Note: I’m using python 2.4 so no “with” support yet.
Write to file with Python 2.4
Write to file with modern Python
Bonus
Improve your
sedusage.