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