script? for converting A to PTR

Kevin Darcy kcd at daimlerchrysler.com
Sat Dec 1 01:22:50 UTC 2001


Drew Weaver wrote:

>         Does anyone have a script that will take a file full of FORWARDS
> (ie. A records) and convert them into PTR records? If so let me know please.

Quick and dirty:

#!/usr/bin/perl

while (<>) {
        @line = split(/\s/);
        $foo{$line[-1]} = $line[0];
}
foreach $i (keys(%foo)) {
        printf("%s.in-addr.arpa. ptr %s.\n",
               join('.', reverse(split(/\./, $i))), $foo{$i});
}


- Kevin




More information about the bind-users mailing list