Q:

Is there an apache equivalent of this samba conf tidying trick?

When configuring samba, I use this method as suggested by the official docs.
testparm -s smb.conf.master > smb.conf
It means I can keep the fully commented version (smb.conf.master) but I also get a stripped down and easily parseable by humans and machine version in smb.conf
Is there an equivalent method for apache's config file?  

A:

I do this frequently:
grep -v '^#' apache.conf > apache-stripped.conf
If you want to get really aggressive and remove blank lines as well:
egrep -v '^(#|$)' apache.conf > apache-stripped.conf
I should point out that the only reason to do this is to make it easier for you to read if you find the comments distracting.  Apache, of course, doesn't mind.  There is no performance gained by removing the comments from the live Apache config, aside from maybe a few microseconds saved at startup.

