I am having the below text in my-config file
<!--<URL>www.abc.com</URL>-->
www.xyz.com
I want to uncomment the commented line and comment the uncommented line. I tried using the sed command
sed -i '/<!--<URL>www.abc.com</URL>-->/s/^#//g' filename
but getting error as
sed: -e expression #1, char 24: unknown command:
/'`
please help in resolving this or correct if anything wrong in my sed command. Thanks in advance.
Since you're using the '/' as the sed delimiter, you must escape '\\' the '/' in the tag.
eg
sed -i '/<!--<URL>www.abc.com<\/URL>-->/s/^#//g' filename
You can also switch your delimiter in sed for better readability more .
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.