This is based on several assumptions:
- we use apache2-like way of configuration - all virtual hosts in separate files
- each file has one ServerName statement and possibly ServerAlias with unlimited amount of names following it
- each file has the same name as domain - either with or without 'www' at the beginning (so for sure it has at least one dot in the name)
- we are only interested in the DNS records pointing to the right IP