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

Re: regex question



On Sun, Apr 13, 2008 at 08:00:00AM -0700, Daniel Burrows wrote:
> On Sun, Apr 13, 2008 at 10:00:42PM +1000, Alex Samad <alex@samad.com.au> was heard to say:
> > On Sat, Apr 12, 2008 at 06:26:26PM -0700, Daniel Burrows wrote:
> > > On Sun, Apr 13, 2008 at 09:37:02AM +1000, Alex Samad <alex@samad.com.au> was heard to say:
> > > > this started out as a grep quetion
> > > > 
> > > > trying to look at a file with out the comments in it
> > > > 
> > > > i tried grep -v '^\s*;'  ; is the comment delimiter.
> > > > 
> > > > but this left me with lots of blank lines.
> > > 
> > >   Have you tried this?
> > > 
> > >     egrep -v '\s*(;|$)'
> > Yes I did (thanks twice), but my question which arose from this was why
> > this did not work 
> > 
> > perl -nle 'next if ( /^\s*;/);  print' sip.conf
> 
>   As you probably guessed from my mail, I don't speak perl; I was just
> trying to solve the problem you said you started with. :-)  From your
> comments above it sounded like you wanted to remove comments and *also*
> blank lines.
> 
> > with a sample file of
> > line 1
> > ;line 2
> >     ;line3
> > line 4
> > 
> > 
> > with the egrep and one -v '^\s*;' why do I end up with 
> > line 1
> > 
> > 
> > line 4
> 
>   I can't reproduce this.  You're saying that "egrep -v '^\s*;'" does
> this?  Because I just get
> 
>     line 1
>     line 4
> 
>   back, as I would expect.
> 
>   Could there be some odd characters in the input file that are
> confusing grep?

my fault I wrote up the above experiment based on what i say happen with
another input file (I made some assumptions, that did not pane out).

Thanks for you help

> 
>   Daniel
> 
> 
> -- 
> To UNSUBSCRIBE, email to debian-user-REQUEST@lists.debian.org 
> with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org
> 
> 

-- 
"Compassionate conservatism [is] most importantly, making sure that government is not the answer to people's problems."

	- George W. Bush
12/05/1998

Attachment: signature.asc
Description: Digital signature


Reply to: