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

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



Arie Reynaldi Zanahar wrote:
Dear,

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

but I think it's too long, I have use $egrep -v '^#' file.conf

but it containt so many blank lines. Is there any suggest what should
I use ? Maybe like combining egrep with other script..  As simple as
possible :)

I've had success with:

egrep -v "^#|^$|^   #|^ *#" httpd.conf

That strips out empty lines, comment lines that have a # in as the first character, coment lines that have a tab and # for the first two characters and comments that begin with multiple spaces followed by the # character.

--
Until later, Geoffrey                     Registered Linux User #108567
Building secure systems inspite of Microsoft


--
Check the headers for your unsubscription address
For additional commands, e-mail: suse-security-help@xxxxxxxx
Security-related bug reports go to security@xxxxxxx, not here