
Code: Select all
sed '/^[[:space:]]*\([#;].*\)*$/d'Thanks brilliant!x1jmp wrote:Thanks for this tip with sed!
My version is this, which also deletes lines with ";", like the smb.confIt's also possible to add exactly this into the .bashrc as an alias.Code: Select all
sed -e 's/[#;].*//;/^\s*$/d'

Code: Select all
grep -e "^[^#]"Code: Select all
sed '/^#\|^$/d' /etc/make.conf.exampleCode: Select all
[%] cat a
#comment1
#comment2
[%] sed '/^#\|^$/d' a
#comment2

Or perhaps gentoolkit. I named mine ecat for Gentoo-ishness and as a nod to Ed Catmur.Sakkath wrote:Maybe `confcat` should go in baselayout
Yeah that's a better ideatimeBandit wrote:Or perhaps gentoolkit. I named mine ecat for Gentoo-ishness and as a nod to Ed Catmur.Sakkath wrote:Maybe `confcat` should go in baselayout
Code: Select all
alias purge="egrep -v '^[[:space:]]*#|^ *$|^$'"