Sedreplace帮助

我需要一些sedreplace协助:

sed -ri 's#logging { /* If you want to enable debugging, eg. using the 'rndc trace' command, * named will try to write the 'named.run' file in the $directory (/var/named"). * By default, SELinux policy does not allow named to modify the /var/named" directory, * so put the default debug log file in data/ : */ channel default_debug { file "data/named.run"; severity dynamic; }; }; #logging { /* If you want to enable debugging, eg. using the 'rndc trace' command, * named will try to write the 'named.run' file in the $directory (/var/named"). * By default, SELinux policy does not allow named to modify the /var/named" directory, * so put the default debug log file in data/ : */ channel default_debug { file "data/named.run"; severity dynamic; }; category security { null; }; }; #g' /etc/named.conf 

基本上我试图添加“类别安全{null;};” 到/etc/named.conf(在不同的服务器上有不同的行号),在很多系统上,sed正在失败。

任何提示和build议将不胜感激。

创build一个文件并input这个

 /severity dynamic;/ { N s/\( *};\)/\1\ncategory security {null;};/g } 

然后保存并像这样运行

 sed -f file /etc/named.conf