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

Re: Striping comment from configuration files on stdout



Jean-Louis Crouzet:
> Jochen Schulz wrote:
>>
>> If you want to strip empty lines and lines beginning with whitespace
>> followed by a ';' as well, do
>>
>> grep -E -v '(^\s*;)|^\s*$'
>>
> OK thanks for the tip now running. I still need display line such as
> 
> bindport=5060                   ; UDP Port to bind to (SIP standard port is 5060)

The pattern above should match only lines that either

- consist only of whitespace, or
- start with whitespace, followed directly by a semicolon

so it should do what you want. But I agree that the other one is easier
to memorize. Regular expressions are write-only -- it's easier to learn
how to write them than to read them without understanding them. ;-)

J.
-- 
Atrocities committed in Rwanda pervade my mind when I am discussing
mundanities with acquaintances.
[Agree]   [Disagree]
                 <http://www.slowlydownward.com/NODATA/data_enter2.html>

Attachment: signature.asc
Description: Digital signature


Reply to: