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

Re: regexp---remove comments---simplification



On Fri, Feb 21, 2003 at 04:51:28PM +0200, Johann Spies wrote:
> On Fri, Feb 21, 2003 at 01:50:31PM +0000, Colin Watson wrote:
> > You'll want something like this:
> > 
> >   grep -v '^\( *#\| $\)' some.conf > condensed.file
> > 
> > or:
> > 
> >   egrep -v '^( *#| $)' some.conf > condensed.file
> 
> And what would that do with a line like this?
> 
> some valid stuff # comment
> 
> As I understand it your solution would delete that line also.

No. Perhaps you should try it. (Note the ^ anchor before ' *#'.)

Whether trailing comments like that are allowed depends on the
configuration file format. IIRC, they are formally not allowed in Apache
configuration files, for example.

-- 
Colin Watson                                  [cjwatson@flatline.org.uk]



Reply to: