Re: [gentoo-user] [OT] confusing RE doesn't work in diff

2005-07-28 Thread Mariusz Pękala
On 2005-07-27 09:43:25 +0200 (Wed, Jul), Christoph Gysin wrote:
 Zhang Weiwu wrote:
 [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.
 
 If it's not mentioned, it possibly uses basic regular expressions.
 
 try:
 
 $ diff -I '/\* \$Id.*\$ \*/' header.inc.php empty
 
 Christoph

Indeed strange. BUT the clue lies in (after many strange results) in
'man grep' where, on my host, it says exactly:

-I regexp
   Ignore changes that just insert or delete lines that match regexp.

Notice the word: 'changes'.
It seems that it means: ignore if WHOLE GROUP of DELETED OR INSERTED
lines matches (every added or deleted line) the provided regexp.

In your case the first line of header.inc.php is included in change-group
but does not matches RE.

Try (to be very simple):
$ diff -I '^.*/.*$' header empty
1,2d0
 ?php
 /* $Id: header.inc.php.template,v 1.58 2005/07/08 05:00:14 milosch 
Exp $ */

$ echo '?php'  empty
$ diff -I '^.*/.*$' header empty
(nothing)
$ :empty
$ diff -I '^.*php.*$' header empty
(nothing - because BOTH lines, considered CHANGED OR DELETED have the
word 'php' inside)

Now the difficult part: how to solve the real problem. :-)

* You may compare grepped files (with grepped out /* $Id:$ */)
* You may try to filter diff output... but I don't like this (by
  intuition - I may be wrong)
* experiment with various options of diff. If only output (not retcode)
  matters then good candidate maybe may be --changed-group-format, which is
  weel described in 'info diff'
* or something other...

HTH

-- 
No virus found in this outgoing message.
Checked by 'grep -i virus $MESSAGE'
Trust me.


pgpxROr6WsLsd.pgp
Description: PGP signature


Re: [gentoo-user] [OT] confusing RE doesn't work in diff

2005-07-27 Thread Zhang Weiwu
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?

-- 
gentoo-user@gentoo.org mailing list



Re: [gentoo-user] [OT] confusing RE doesn't work in diff

2005-07-27 Thread Christoph Gysin

Zhang Weiwu wrote:

[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.


If it's not mentioned, it possibly uses basic regular expressions.

try:

$ diff -I '/\* \$Id.*\$ \*/' header.inc.php empty

Christoph
--
echo mailto: NOSPAM !#$.'*'|sed 's. ..'|tr * !#:2 [EMAIL PROTECTED]
--
gentoo-user@gentoo.org mailing list



Re: [gentoo-user] [OT] confusing RE doesn't work in diff

2005-07-26 Thread Mariusz Pękala
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


-- 
No virus found in this outgoing message.
Checked by 'grep -i virus $MESSAGE'
Trust me.


pgpfnqmjJw5aa.pgp
Description: PGP signature


[gentoo-user] [OT] confusing RE doesn't work in diff

2005-07-25 Thread Zhang Weiwu
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?

-- 
gentoo-user@gentoo.org mailing list



Re: [gentoo-user] [OT] confusing RE doesn't work in diff

2005-07-25 Thread Christoph Gysin

Zhang Weiwu wrote:

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?


^ only matches at the beginning of a line. This isn't the case in your 
examples.


Christoph
--
echo mailto: NOSPAM !#$.'*'|sed 's. ..'|tr * !#:2 [EMAIL PROTECTED]
--
gentoo-user@gentoo.org mailing list