I\'m writing a small method to replace some text in a file. The only argument I need is the new text, as it is always the same file and text to be replaced.
I\'m hav
What is wrong is that there is some difference. Yeah, I know that's not helpful, but you need to figure out the difference.
Try running this:
import os
def updateExportConfigId(id):
stringId = "%s" % id
cmd1 = "sed '1,$s/MANAGER_ID=[0-9]*/MANAGER_ID=" + stringId + "/g' path/file.old > path/file.new"
stringId = "GRRRRRRRRR"
cmd2 = "sed '1,$s/MANAGER_ID=[0-9]*/MANAGER_ID=" + stringId + "/g' path/file.old > path/file.new"
print "cmd1:" , cmd1
print "cmd2:" , cmd2
print cmd1 == cmd2
updateExportConfigId("GRRRRRRRRR")
The code should print:
sed '1,$s/MANAGER_ID=[0-9]*/MANAGER_ID=GRRRRRRRRR/g' path/file.old > path/file.new
sed '1,$s/MANAGER_ID=[0-9]*/MANAGER_ID=GRRRRRRRRR/g' path/file.old > path/file.new
True
Thereby showing that they are exactly the same. If the last line is "False" then they are not the same, and you should be able to see the difference.