Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I need some assistance with some sed replaces:

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

Basically I'm trying to add "category security { null; };" to /etc/named.conf (different line numbers on different servers) on quite a few systems, and sed is failing out on me.

Any tips and suggestions would be greatly appreciated.

share|improve this question
add comment

1 Answer

up vote 1 down vote accepted

Create a file and enter this

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

then save and run it like this

sed -f file /etc/named.conf
share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.