我在 sed 中有一个小问题,我想替换以下行:
space here#Include "/usr/local/apache/conf/userdata/std/2/varr1/var2/*.conf"
或者
space here# Include "/usr/local/apache/conf/userdata/std/2/varr1/varr2/*.conf"
(注意#后面的空格)
到以下
Include "/usr/local/apache/conf/userdata/std/2/varr1/varr2/*.conf"
以下代码有效,行不以空格开头:
sed -i "s/# Include \"\/usr\/local\/apache\/conf\/userdata\/std\/2\/$varr1\/$varr2\/\*.conf\"/Include \"\/usr\/local\/apache\/conf\/userdata\/std\/2\/$varr1\/$varr2\/\*.conf\"/" file.name
任何帮助将不胜感激,谢谢大家