in reply to Re^3: Perl script to comment out lines in named.con file
in thread Perl script to comment out lines in named.conf file

hey
i think iam now very close to the right solution ..
i write this
#!/usr/bin/perl -w use strict; print " please enter the domain name: "; my $targetdomain = <STDIN>; chomp $targetdomain; my $file = "/home/blackice/hello"; open HAN,$file || die "error opening file: $!"; my @fileContent = <HAN>; close(HAN); for( my $i = 0; $i < @fileContent; $i++ ){ if( $fileContent[$i] =~ m/^zone\s+"$targetdomain"/ ){ $fileContent[$i] =~ s/\n/\n#/g; } } open HAN, ">$file"; print HAN @fileContent; close(HAN);

after run the script th script only comment the second line
#type master; only !
and i want to comment all the lines and thanks for you help

Replies are listed 'Best First'.
Re^5: Perl script to comment out lines in named.con file
by GrandFather (Saint) on Oct 05, 2007 at 04:31 UTC