Removed remarked lines from config files

When working with config files that have lots of remarked (or hashed) lines.  It can sometimes be hard to find the lines that actually contain the configuration parameters.

cd /etc/squid3/

You can use the following commands to save a copy of the original config, and then strip out all of the lines containing #.

sudo cp squid.conf squid.conf.backup && sudo sed /#/d squid.conf > squid.temp && sudo sed '/^$/d' squid.temp > squid.conf && sudo rm squid.temp

First this command will backup the squid.conf to squid.conf.backup so if there are any issues you can restore from this backup.

Next all of the lines with a # are removed (leaving blank lines) and written to squid.temp

Next all of the blank lines are deleted from squid.temp and written to squid.conf

Finally squid.temp is deleted.

Please Note: This will remove all lines with the # character in.  So before running this, make sure none of the lines you need have a #  character.