I'm currently having trouble trying to run this code which is supposed to call the unix command sed
to find and replace the string hello
with goodbye
in the file ./myfile.txt
This works fine if you run it from the command line, but if I try the same thing from my Go code....
command := exec.Command("sed", "-e \"s/hello/goodbye/g\" ./myfile.txt")
result,err := command.CombinedOutput()
fmt.Println(string(result))
Bit I just keep on getting this output
sed: -e expression #1, char 2: unknown command: `"'
Is there some sort of quote escaping going on or something to cause it to interpret the string wrong?
Any help would be appreciated