Strip comments from config files
This is at short script to strip/remove comments from config files
#!/bin/bash # Code to cat a config file removing all comments and blank lines. grep -vh '^[[:space:]]*#' "$@" | grep -v '^$'
Usage: ./confcat.sh /etc/make.conf
Alternativ is to use sed
cat filename | sed -e 's/#.*//;/^\s*$/d' "$@"
This also strips comments at the end of a line, though it looks a little bit ugly