Mass Update of DNS Records
Barry Margolin
barry.margolin at level3.com
Thu Aug 28 22:00:44 UTC 2003
In article <bilren$2a1g$1 at sf1.isc.org>, <phn at icke-reklam.ipsec.nu> wrote:
>Jake <jake at dontmailme.coma> wrote:
>> I need to change the IP address of about 200 DNS records and also increase
>> the serial number by one for each. Is there a script out there to do this?
>
>> Basically I need it done like this:
>
>> 1) Look through all zone files for IP address X
>
>> 2) If IP address X found, replace it with Y
>
>> 3) Increment serial number for this record
>
>
>Using 'vi' will take an hour and a half. It would take me more time
>to find a scripting solution then to "just do it".
But the time spent is more interesting. All that repetitive editing is
tedious.
It can actually be done with a Perl one-liner if you follow a regular
commenting convention for the serial number line
perl -p -i.bak -e 's/\bX.X.X.X\b/Y.Y.Y.Y/'; s/\d+/$&+1/e if /; serial/' db.*
Replace '; serial' with whatever comment you put on the serial number line.
--
Barry Margolin, barry.margolin at level3.com
Level(3), Woburn, MA
*** DON'T SEND TECHNICAL QUESTIONS DIRECTLY TO ME, post them to newsgroups.
Please DON'T copy followups to me -- I'll assume it wasn't posted to the group.
More information about the bind-users
mailing list