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 <email@example.com> 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
why do I need the length statement
perl -nle 'next if ( /^s*;/); print if length $_ > 0' sip.conf
with a sample file of
with the egrep and one -v '^s*;' why do I end up with
Why do I get the blank lines ? shouldn't those blank lines not be
printed. If I turned it around to egrep '^s*;' I would get
and no blank lines.
The same with the perl statement perl -nle 'next if ( /^s*;/); print'
my understanding is this expands to
next if (^s*
so when it comes time to process line2, it should match the if and goto
next, which should then read the next line, which matches and then the
next line at which point it should print out line 4.
But it doesn't it prints out a ^$ for line 3 & 4, I am curious to know
> Seems a lot easier than writing hairy Perl code (but I repeat myself).
> To UNSUBSCRIBE, email to debian-user-REQUEST@lists.debian.org
> with a subject of "unsubscribe". Trouble? Contact firstname.lastname@example.org
Not affiliated with the American Red Cross.