I want to use sed to modify a passage in the txtsetup.sif file, changing
SetupSourcePath = "\"
to
SetupSourcePath = "\WINXP\ACER\"
I know that \ is an escape character, but I have tried many methods and all prompt errors. The following are what I have tried:
sed -i "s/SetupSourcePath = "\"/SetupSourcePath = "\WINXP\ACER\"/g" txtsetup.sif
sed -i "s/SetupSourcePath = "\\"/SetupSourcePath = "\\WINXP\\ACER\\"/g" txtsetup.sif
sed -i "s/SetupSourcePath = "\\\"/SetupSourcePath = "\\\WINXP\\\ACER\\\"/g" txtsetup.sif
sed -i "s/SetupSourcePath = "\/"/SetupSourcePath = "\/WINXP\/ACER\/"/g" txtsetup.sif
There are others, but each time it is executed, an error is prompted, generally saying that the s parameter is incorrect. If changed to
sed -i "s/SetupSourcePath/SetupSourcePathWINXP/g" txtsetup.sif
In this way, there is no problem, so I am sure that I expressed the \ special character in sed incorrectly. I hope the bosses can take a look and help correct this. Thank you everyone!
SetupSourcePath = "\"
to
SetupSourcePath = "\WINXP\ACER\"
I know that \ is an escape character, but I have tried many methods and all prompt errors. The following are what I have tried:
sed -i "s/SetupSourcePath = "\"/SetupSourcePath = "\WINXP\ACER\"/g" txtsetup.sif
sed -i "s/SetupSourcePath = "\\"/SetupSourcePath = "\\WINXP\\ACER\\"/g" txtsetup.sif
sed -i "s/SetupSourcePath = "\\\"/SetupSourcePath = "\\\WINXP\\\ACER\\\"/g" txtsetup.sif
sed -i "s/SetupSourcePath = "\/"/SetupSourcePath = "\/WINXP\/ACER\/"/g" txtsetup.sif
There are others, but each time it is executed, an error is prompted, generally saying that the s parameter is incorrect. If changed to
sed -i "s/SetupSourcePath/SetupSourcePathWINXP/g" txtsetup.sif
In this way, there is no problem, so I am sure that I expressed the \ special character in sed incorrectly. I hope the bosses can take a look and help correct this. Thank you everyone!
