Created
December 8, 2014 20:06
-
-
Save scpike/a72a748126cbb4359c03 to your computer and use it in GitHub Desktop.
Namecheap hosts file => Route 53
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File.readlines(ARGV[0]).each do |l| | |
l.chomp! | |
xs = l.split("\t") | |
"@ MX ALT1.ASPMX.L.GOOGLE.COM. 20 1800" | |
if xs.count == 5 | |
owner, rtype, tdata, pref, ttl = xs | |
pref = nil if pref.strip == "0" | |
next if rtype.strip == 'URL' | |
puts [owner, ttl, "IN", rtype, pref, tdata].compact.join("\t") | |
# example.com. IN MX 10 mail.example.com. ; mail.example.com is the mailserver for example.com | |
else | |
puts l unless l.to_s.strip == '' | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment