我正在尝试自动化构建和部署,但发现我无法正确地插入
这是表达式。
也许更好的想法是只使用SED?
ServerName
。# Global configuration
#
由于某些愚蠢的原因,awk没有解释我的\n
。如果我删除\n#
,它可以正常工作,但我希望它在全局注释中而不是在其中间。我在这里做错了什么?
希望能得到回复。
# Global configuration
#
ServerName localhost
这是表达式。
awk '/# Global configuration\n#/ { print; print "\nServerName localhost"; next }1' apache2.conf
也许更好的想法是只使用SED?