How to preform mass changes to DNS zones

The following will do a regex match through /var/named and change anything in a .db file (your DNS zones) that matches the string “example1.com” to “example2.com”. We have found the most common need for this is if someone had the nameserver changed or had them listed wrong in the basic cPanel section when they created their accounts and the zones were created with the wrong NS entries. Ultimately this process can be used to make any regex change to the zone file by altering the command fed to sed in step one(s/example1.com/example2.com/g).