diff has an option -I regexp, which ignores changes that just insert or delete lines that match the given regexp. I need an analogue of this for the ca
My open-source Linux tool 'dif' compares files while ignoring various differences.
It has many options for doing search/replace, ignoring whitespace, comments, or timestamps, sorting the input files, ignoring certain lines, etc.
After preprocessing the input files, it runs the Linux tools meld, gvimdiff, tkdiff, diff, or kompare on these intermediate files.
Installation is not required, just download and run the 'dif' executable from https://github.com/koknat/dif
For your use case, try the search and replace option:
./dif file1 file2 -search 'ab[XY]d' -replace 'abd' -diff