Mariusz Pękala wrote:
> On 2005-07-25 17:50:37 +0800 (Mon, Jul), Zhang Weiwu wrote:
> > > My RE must be wrong but I can hardly successfully match a whole line
> > > like the below example:
> > >
> > > This works:
> > > [EMAIL PROTECTED]:/tmp$ egrep "\b*\/[*].*[*]\/\b*" Calendar.php
> > > /* $Id: class.boalarm.inc.php,v 1.1.1.1 2005/03/18 09:17:36
> > > dawnlinux Exp $ */
> > > /* $Id: class.boalarm.inc.php,v 1.11 2004/05/23 14:51:27
> > > ralfbecker Exp $ */
> > >
> > > This doesn't work:
> > > [EMAIL PROTECTED]:/tmp$ egrep "^\b*\/[*].*[*]\/\b*$" Calendar.php
> > >
> > > any hint?
>
> man grep:
> The symbol \b matches the empty string at the edge of a word
>
> It seems that '/' is not considered to be a part of a word.
>
> I suppose you may use "^[[:space:]]*/[*].*[*]/[[:space:]]*$" Calendar.php
Thank you! Your RE suggested does work and I discovered this [[:space:]] pretty
useful. I missed it in man grep.
However there is another strange behavor. This works:
[EMAIL PROTECTED]:/tmp$ cat header.inc.php
<?php
/* $Id: header.inc.php.template,v 1.58 2005/07/08 05:00:14 milosch Exp
$ */
[EMAIL PROTECTED]:/tmp$ grep "^[[:space:]]*/[*].*[*]/[[:space:]]*$"
header.inc.php
/* $Id: header.inc.php.template,v 1.58 2005/07/08 05:00:14 milosch Exp
$ */
And this doesn't work:
[EMAIL PROTECTED]:/tmp$ :>empty
[EMAIL PROTECTED]:/tmp$ diff -I "^[[:space:]]*/[*].*[*]/[[:space:]]*$"
header.inc.php empty
1,2d0
< <?php
< /* $Id: header.inc.php.template,v 1.58 2005/07/08 05:00:14 milosch Exp
$ */
in man it's being said,
-I RE --ignore-matching-lines=RE
Ignore changes whose lines all match RE.
I read man grep and it seems there are two sets of RE, extended and basic. But
it's not mensioned in diff(1) wheather or not diff(1) takes extended or basic
RE. I am using Debian so it should be gnu diff.
Any thing more to teach me?
--
[email protected] mailing list