Назад | Перейти на главную страницу

Sed Replace Help

Мне нужна помощь с некоторыми заменами sed:

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 у меня не работает.

Будем признательны за любые советы и предложения.

Создайте файл и введите это

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

затем сохраните и запустите его так

sed -f file /etc/named.conf