Hi,
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 having a problem using the os.system() call, when I try to use the argument of the method
If I use a string like below, everything runs ok:
stringId = "GRRRRRRRRR"
cmd="sed '1,$s/MANAGER_ID=[0-9]*/MANAGER_ID=" + stringId + "/g' path/file.old > path/file.new"
os.system(cmd)
Now, if i try to give a string as a parameter like below, the command is not executed. I do a print to see if the command is correct, and it is. I can even execute it with success if I copy / paste to my shell
import os
def updateExportConfigId(id):
stringId = "%s" % id
cmd= "sed '1,$s/MANAGER_ID=[0-9]*/MANAGER_ID=" + stringId + "/g' path/file.old > path/file.new"
print "command is " + cmd
os.system(cmd)
Does anyone knows what is wrong?
Thanks