- To: slug@xxxxxxxxxxx
- Subject: Re: [SLUG] grep question
- From: "Amos Shapira" <amos.shapira@xxxxxxxxx>
- Date: Sun, 13 Apr 2008 21:55:13 +1000
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:message-id:date:from:to:subject:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; bh=Sek9WYmcce52bCY/3Sg/maYm3qynEcQlVfbs08PC6T8=; b=OolEphlckfKazskJB3fbeYgbL3vejnR8mLON+PtPTjzbYZMlbjKWfJJfU/X0jv5nj8c3S7xtQjYlq9mFAXGAU69BHeurkMalzHWgIXYaUihpm9lqa5s6ibpSMKvkbH1Wz9N5YqgQATXk7oq8YG2spxns2gAG/oUiBOpl/w+kyYU=
- Domainkey-signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:to:subject:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; b=UsaYqH5j5XZh0gGEsvW4fTq3bRt9aIlg4KsfMhehOmTjeywDMtierZw57f+pRL1k6BqauM03qij6zQCy2PNbNFouTou+z7+wg6z0Tvd0qEHC4DnOuldCzzfdvPlWAA/g02MqskspGP6K4PXw3sX+23CLkdJZDQA/LiMRlTgZ+jQ=
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