Tugger the SLUGger!SLUG Mailing List Archives

Re: [SLUG] grep question


On Sun, Apr 13, 2008 at 9:41 AM, Alex Samad <alex@xxxxxxxxxxxx> wrote:
>  > Try grep -Ev '^(\W*;|$)'
>  great that works, (i changed to \s* instead, also tried the [[:space:]]
>  and it worked)
>
>  I don't understand hwy i need to test for ^$, I had thought that once a
>  line test positive for ^\s*; it would be excluded ?

Because empty lines do not match the '^\W*;' part (they don't have a
';' in them to match the regular expression) and so grep prints them.
The '^$' part matches empty lines and so they are filtered out.

--Amos