Here's an interesting challenge...

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


Files are listed as follows...
etc, etc

I have set of zone files in /var/named



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 or with the domain name corresponding to each file, ending in a period.

e.g. in the filename "" look for instances of "" or "" and replace with ""

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?