How to ignore some differences in diff command?

前端 未结 5 822
情书的邮戳
情书的邮戳 2021-02-06 23:13

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

5条回答
  •  清酒与你
    2021-02-06 23:34

    You could use sed to replace instances of the pattern with a standard string:

    diff <(sed 's/ab[XY]d/ab__REPLACED__d/g' file1) <(sed 's/ab[XY]d/ab__REPLACED__d/g' file2)
    

提交回复
热议问题