Gentoo Archives: gentoo-user

From: Zhang Weiwu <zhangweiwu@××××××.com>
To: gentoo-user@l.g.o
Cc: skoot@××.pl
Subject: Re: [gentoo-user] [OT] confusing RE doesn't work in diff
Date: Wed, 27 Jul 2005 07:21:01
Message-Id: 1122448118.6628.88.camel@localhost.localdomain
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: > > > zhangweiwu@Bach:/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: > > > zhangweiwu@Bach:/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: zhangweiwu@Bach:/tmp$ cat header.inc.php <?php /* $Id: header.inc.php.template,v 1.58 2005/07/08 05:00:14 milosch Exp $ */ zhangweiwu@Bach:/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: zhangweiwu@Bach:/tmp$ :>empty zhangweiwu@Bach:/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? -- gentoo-user@g.o mailing list

Replies

Subject Author
Re: [gentoo-user] [OT] confusing RE doesn't work in diff Christoph Gysin <cgysin@×××.ch>