Very good but seems to have a bug

I really like the regex of it all. Searches most things. But I have found that when the host alias is missing it does not work properly.

Also the search does a grep -A INT so if the configuration is less default and places the grep’ed variable outside of the lookahead it will fail also.
example:
grep -EA2 “define[ ]+host[ ]+” /path/to/objects.cache | grep -Eo “(host_name|alias).+”
if alias is on position 3+ it will miss it.

Perhaps first grep all the required parameters and then split the ones you want. Something like below.
example:
grep “(host_name|alias|define[ ]+host[ ]+).+” |grep -EA2 “define[ ]+host[ ]+” /path/to/objects.cache | grep -Eo “(host_name|alias).+”