Just a quick one, as I haven’t posted for a while. This is a cool trick for getting the juice out of heavily commented files. In particular I used this on /etc/samba/smb.conf, but also good for apache2.conf, php.ini etc. The magic is this.
grep -v -e "^#" -e "^;" -e "^$" /etc/samba/smb.conf
Basically, ignore all lines starting with comments, and all blank lines.
Then, if you really want to get fancy, you can alias it to a command like this:
alias grepc='grep -v -e "^#" -e "^;" -e "^$"'
So all you have to type now is