egrep -v "^[[:blank:]]*(#|$)" filename
As simple as one single command :
find -type d -empty -delete
Powered by WordPress
Filter out comments and empty lines from config files