You can run this command to strip the comments (line that begins with a #) and remove blank lines from a file in Linux :
cat /path/to/fileĀ | grep -v ^# | grep -v ^$
Example:
To remove comment lines from squid.conf you can run the following command:
cat /etc/squid/squid.conf | grep -v ^# | grep -v ^$ > squid_stripped.conf

Recent Comments