Ignoring specific differences in diff

Posted by naumcho on Stack Overflow See other posts from Stack Overflow or by naumcho
Published on 2010-05-10T23:23:20Z Indexed on 2010/05/10 23:44 UTC
Read the original article Hit count: 139

Filed under:
|

When doing recursive diffs I want to ignore expected differences/translations - is there a way to do that with standard unix tools?

E.g.

file1:
1 ...
2 /path/to/something/ver1/blah/blah
3 /path/to/something/ver1/blah/blah
4 ...

file2:
1 ...
2 /path/to/something/ver2/blah/blah
3 /path/to/something/ver3/blah/blah
4 ...

I want to be able to do something like:

diff file1 file2 --ignore-transltion "ver1>ver2"

This should show only show me that line 3 is different

Does anyone know of a good way to do that? I can easily write a perl script to do it but i will end up re-implementing most of the rest of the functionality of 'diff'.

Update: My goal is to run this on directories with different versions of the same files with "diff -r" so I can spot unexpected differences in versions.

© Stack Overflow or respective owner

Related posts about shell

Related posts about diff