Problem using os.system() with sed command
<p>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.</p>

<p>I'm having a problem using the os.system() call, when I try to use the argument of the method</p>

<p>If I use a string like below, everything runs ok:</p>

<pre><code>stringId = "GRRRRRRRRR"
cmd="sed '1,$s/MANAGER_ID=[0-9]*/MANAGER_ID=" + stringId + "/g' path/file.old &gt; path/file.new"
os.system(cmd)
</code></pre>

<p>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</p>

<pre><code>import os
def updateExportConfigId(id):
stringId = "%s" % id
cmd= "sed '1,$s/MANAGER_ID=[0-9]*/MANAGER_ID=" + stringId + "/g' path/file.old &gt; path/file.new"
print "command is " + cmd
os.system(cmd)
</code></pre>

<p>Does anyone knows what is wrong?</p>

<p>Thanks</p>
