Convert DNS Export Into BIND Format
One bright sunny day I received a sloppy text file which was most likely exported through a zone AXFR and my task was to import the records into a CDN’s DNS. The import was not very happy with it, however, I did figure out how to fix the issue without manually editing any data by converting the DNS export into BIND format.
The command is called named-compilezone
and it’s pretty awesome (included in the bind-utils pkg). Essentially all you need to do is import the text file and write it out as raw, then import the raw and export as text. It’s a two step process but you could make it a one-liner:
$ named-compilezone -f text -F raw -o YourFile.com.raw DomainName.com OriginalFile.txt && named-compilezone -f raw -F text -o YourNewFile.bind.text YourDomain.com YourFile.com.raw
Originally I found the idea on Internet Systems Consortium. In my opinion, they are one of the least known and thanked software companies that have greatly contributed to the internet infrastructure in general.
BIND /ˈbaɪnd/, or named /ˈneɪmdiː/, is the most widely used Domain Name System (DNS) software on the Internet. On Unix-like operating systems it is the de factostandard.
The software was originally designed at the University of California Berkeley (UCB) in the early 1980s. The name originates as an acronym of Berkeley Internet Name Domain, reflecting the application’s use within UCB. The software consists, most prominently, of the DNS server component, called named, a contracted form of name daemon. In addition, the suite contains various administration tools, and a DNS resolver interface library. The latest version of BIND is BIND 9, first released in 2000.
[credit goes to Wikipedia]