so thanks for your wonderful answers so if the file was messy or something i mean if before the script running the file looks like this
zone "blah.com" {
xxxx
xxxx
xxxx
}
zone "bar.com" {
xxxx
xxxx
xxxxx
xxxxx
}
notice that the file has already 2 blank lines . so how i can make the script to edit to make the file...
User Profile
Collapse
-
Many Thanks it works fine but kindly can you show me how that works ?
i mean can u illustrate the code meaning for me ?
i donot know what is the MAINLOOP and also teh $^I and i will be thankfulLeave a comment:
-
After deleting lines from a file i need to keep the file order
Hello All,
i have a Perl Script that deleting Zones from named.conf file and here is the script
[CODE=perl]#!/usr/bin/perl -w
use strict;
print "please enter the domain name: ";
chomp (my $targetdomain = <STDIN>);
my $file = "/home/adam/Desktop/hello"; # copied to my home folder
rename $file, "$file.bak" or die "Can't... -
-
yes i need
i want to improve this script to not just comment a fixed length of the lines but i want to make it global so i asked in forums and i got that script that works wonderfully well .,
...Code:#!/usr/bin/perl -w use strict; print " please enter the domain name: "; my $targetdomain = <STDIN>; chomp $targetdomain; my $file = "/home/blackice/hello";
Leave a comment:
-
i have done someting which is a condition if it find the }; it will break but the break didnot work and it had an error
[code=perl]
#!/usr/bin/perl -w
use strict;
print " please enter the domain name: ";
my $targetdomain = <STDIN>;
chomp $targetdomain;
my $file = "/home/adam/Desktop/hello";
open...Leave a comment:
-
The script is working well but i need to improve itis function .
hello all ...,
first i would thank all the people who are in this forums cause they are very helpful ...,
By the way i had some posts hers about comment out the named.conf file the script is simply comment out the zones in the file and it works well
while i was testing scrpt i found that the script is working in an fixed way which means that the zone must be 5 lines if it not a five line the script... -
-
thanks it works and better than i created
but could you kindly explain me the mechanism of this code and what is Fcntl ':flock'; and how it works i want more explain cause this types of code will help me alot in editing various type of linux files .
and thanks again too much ....
------------------------------------------------------------------------------------------------
back to my code i did some...Leave a comment:
-
aha i need solution
i think iam now very close to the right solution ..
here is the code :-
...Code:#!/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:
Leave a comment:
-
thanks for your support
but what about if i want to after searching comments the empty line before the zone name and comment five lines after commenting the empty line before the zoneLeave a comment:
-
sorry for that ....,
I want to write a perl script which will comment out a domain in my named.conf file for Bind.
as a test i made a file in my home directory to perform tests on it ...
the file is /home/blackice/hello
and i wrote this script
...Code:#!/usr/bin/perl -w use strict; print " please enter the domain name: ";
Leave a comment:
-
NEED HELP IN Search comment lines Perl script
Hello all
this thread ihttp://www.thescripts. com/forum/thread50290.htm l contains what i need but i cannot understand some of the code i need more explain ....
...Code:my $sampleinput = <<"EOF"; zone "dontchangethisdomain.com" { type master; file "/somepath/to/dontchangethisdomain.com"; notify yes; } zone "mydomain.com"
No activity results to display
Show More
Leave a comment: