On Tue, 2002-10-15 at 11:40, Jonathan M. Slivko wrote:
> Ed,
> 
> I would rather have everything scripted as the change will be occurring
> rather fast and without too much notice, I don't have time for mistakes.
> Again, I appreciate all the help. Thanks.
> 

I have been working with awk lately and this seems a good time for it.  

this should come close to the dns solution.  I am no dns guru this
worked on a test in my lab.  Hopefully will get you started anyway.

Cut out from between the snip lines and save in a file called
changeips.awk

Change the ipaddresses in the BEGIN Section

Then call awk passing it the name of the script file and the file to be
processed and redirect the output.

awk -f changeips.awk zonefilename >zonefilename.new

if it looks good you can the copy it over.

modifing the oldip regular expression to also work on the reverse file
should be trivial


###################  begin snip   ##################################
#!/bin/awk

BEGIN {
#  set the variables for the address change
# * * * * * * * * * * * * * * * * * * * * * * * * 

#    Make sure you leave the $ at the end of the oldip address
# to take care of the situation where the last octet is less thatn
# three digits in decimal   

# * * * * * * * * * * * * * * * * * ** * * * * *     

    oldip="192.168.0.13$"
    newip="192.168.0.123"
}
{
# increment the serial number which should be the line directly below
# the SOA line
if ($0 ~ /SOA/) {
    print;
    getline;
    print "\t\t\t"$1+1;
    }
else {

    if (match ($0, oldip)) {
        sub(oldip,newip)
    }
    print
}
}

########################## end snip ###############################

Bret




-- 
redhat-list mailing list
unsubscribe mailto:[EMAIL PROTECTED]?subject=unsubscribe
https://listman.redhat.com/mailman/listinfo/redhat-list

Reply via email to