[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [suse-security] Grep uncomment lines from .conf



I want to grep lines that not commented from a file, Someone said that I can use $sed -e '/^[[:space:]]*#/d;/^[[:space:]]*$/d' file.conf

--> Another idea to remove these kind of comments, even if they do not start in the beginning of the line:

sed -e 's/#.*//g'|grep -v '^$'

Oh, this seems to turn into a golf contest.-)

Here, this works:
grep -vP '^[ \t]*(#|$)'

This should work too, but for some reason grep dumps core:
grep -vP '^\s*(#|$)'

	-jk

Attachment: signature.asc
Description: OpenPGP digital signature