I have seen multiple posts on Stack overflow with various solutions to this problem. I tried various versions of posted solution, but I can't get it to work.
I am writing a perl script where I want to
my $fileName = "apple";
my $newName = "banana";
my $ tmpPath = "/etc/ria";
["/usr/bin/sed","-i ''", "s/${fileName}/${newName}/g", $tmpPath]
I have tried various different combinations of this (i.e.
["/usr/bin/sed","-i''", "s/${fileName}/${newName}/g", $tmpPath]
["/usr/bin/sed","-i", '\'\', "s/${fileName}/${newName}/g", $tmpPath]
["/usr/bin/sed","-i", '\'\', '-e', "s/${fileName}/${newName}/g", $tmpPath]
However each time I run this, it creates ria & ria''. I don't want the second file, ria''.
Can this not be accomplished? Or is there some other editor I can use? I don't want to install anything (i.e. gsed) on my mac.
I am running it as system(@command);
.