Removing Comments and Blank lines of a config file
Jump to navigation Jump to search
Using 'grep' and 'sed' we can strip out comments and blank lines of any file. you can then redirect the output to a file if you so wish. In this example I will use it to remove the comments and blank lines from my apache2.conf file
grep -v "#" /etc/apache2/apache2.conf | sed -e '/^$/d'