making PTR records from bind zone files

This will make PTR records out of a bind zone file in one line:

cat domain_name.db | grep -e ^subdomain | tr -s ” ” | tr ‘ ‘ ‘ ‘ | awk -F’ ‘ ‘{print $4″ IN PTR “$1″.domain_name.com”}’| sed ‘s/\([0-9]*\)\.\([0-9]*\)\.\([0-9]*\)\.\([0-9]*\)\(.*\)/\4.\3.\2\5/g’ >> db.172

 

Don’t forget to raise SOA serial and reload the zone.

Leave a comment