in reply to qx + sed not working
You don't need sed for that. Use Perl regexp substitution in your script. Or continue to use the shell, but with a Perl one-liner:
$ perl -pi -e 's/Foo/Bar/' file1 file2 subdir1/file3 [download]