Perl-Sensitive Sunglasses | |
PerlMonks |
Perl script to comment out lines in named.conf fileby firewall00 (Acolyte) |
on Oct 04, 2007 at 21:40 UTC ( [id://642777]=perlquestion: print w/replies, xml ) | Need Help?? |
firewall00 has asked for the wisdom of the Perl Monks concerning the following question:
hello all
i want to make a perl script that : - 1.) ask user to enter the domain name which is in the zone that will be commented . 2.) search in the named.conf file for a multi line string including domain that entered by the user 2.) comment out the whole zone that including the matching domain name , from the empty line before the zone name and then to a five lines "to comment all the zone part . here is a sample of that file : zone "dontchangethisdomain.com" { type master; file "/somepath/to/dontchangethisdomain.com"; notify yes; } zone "mydomain.com" { type master; file "/path/to/zone/mydomain.com"; notify yes; } zone "leavethisalonetoo.com" { type master; file "/other/path/to/leavethisalonetoo.com"; notify yes; } i worte that code and i cannot figure out what to do next
first: i asked the user to enter the domain for the zone that will be commented . then i open the file by a file handler and search with a matching string for a matching zone that include tha $targetdomain which is entered by the user . i just finished at here but how i can comment the lines of the zone starting from the empty line before the zone name till the last '}' without affecting other zones ... sorry for the long thread and any help will be appreciated :)
Back to
Seekers of Perl Wisdom
|
|