Issue
I want to remove below string from a file in Unix:
<?xml version='1.0' encoding='UTF-8'?>
The file content is exactly this:
<?xml version='1.0' encoding='UTF-8'?>Hello World
in one single continuous line.
I am using the following command to achieve the same:
sed s'/<?xml version='1.0' encoding='UTF-8'?>//g' myFile > myFile1
However, the resultant file myFile1 is still having the string.
How to achieve this ?
Solution
Use double quotes for the outer quotes to avoid the escape issue:
sed "s/<?xml version='1.0' encoding='UTF-8'?>//g" myFile > myFile1
Answered By - Thomas