Here's an interesting challenge...

I have a file that contains a list of domain names, one per line.

/etc/localdomains

Files are listed as follows...

mydomain.com
yourdomain.co.uk
theirdomain.net
etc, etc

I have set of zone files in /var/named

example...

/var/named/mydomain.com.db
/var/named/yourdomain.co.uk.db
/var/named/theirdomain.net.db

I need to identify all matching files in /var/named that match the domain names in /etc/localdomains and copy them to a new directory /root/temp

Then - for all files in /root/temp I need to replace any instance of mx1.host.net. or mx2.host.net with the domain name corresponding to each file, ending in a period.

e.g. in the filename "mydomain.com.db" look for instances of "mx1.host.net" or "mx2.host.net" and replace with "mydomain.com."

It should do this for all files, using each files own filename before the "db" part, as the replacement for the old mx hostname.

Would this be quite easy?