in reply to Re^2: Deleting lines from named.conf file
in thread Deleting lines from named.conf file
my $comment = 0; my $block = 0; while(<$in>) { if (/^zone\s+"$targetdomain"/) { $comment++; $block += () = /(\{)/g; # print $out '// '.$_; next; } if($comment) { $block += () = /(\{)/g; s!^!// ! if $comment or $block; $block -= () = /(\})/g; $comment = 0 unless $block; } print $out $_ unless $comment; }
Since that trivial task seems to be too difficult for you, I gave you a link to a tool which handles all things zone file related. Yes, it relies on a database, but if you have to do more than casual changes to zone files, for which you could also fire up your editor and do changes by hand, it is the right way to go.
--shmem
_($_=" "x(1<<5)."?\n".q·/)Oo. G°\ /
/\_¯/(q /
---------------------------- \__(m.====·.(_("always off the crowd"))."·
");sub _{s./.($e="'Itrs `mnsgdq Gdbj O`qkdq")=~y/"-y/#-z/;$e.e && print}
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^4: Deleting lines from named.conf file
by chromatic (Archbishop) on Nov 10, 2007 at 22:38 UTC | |
by shmem (Chancellor) on Nov 10, 2007 at 22:44 UTC | |
|
Re^4: Deleting lines from named.conf file
by firewall00 (Acolyte) on Nov 10, 2007 at 21:38 UTC | |
by shmem (Chancellor) on Nov 10, 2007 at 21:52 UTC | |
by firewall00 (Acolyte) on Nov 10, 2007 at 22:37 UTC | |
by shmem (Chancellor) on Nov 10, 2007 at 23:32 UTC | |
by firewall00 (Acolyte) on Nov 11, 2007 at 00:05 UTC | |
|