d我一直在尝试做与此非常相似的事情... Bash“diff”实用程序在使用正则表达式时显示文件不同
并且已经做了几个小时但没有运气。
我确信 -I 选项不起作用。下面是使用另一个问题给出的示例进行的测试。
注意:我使用的是 RHEL6 附带的标准版本的 'diff',并且 -I 包含在手册页中,因此没有理由相信它不应该工作,但事实并非如此。任何帮助或指导将不胜感激
[toernerg@uschi12devwom27: ~] $ cat testfile1
// $Id: one
data
[toernerg@uschi12devwom27: ~] $ cat testfile2
// $Id: two
data
[toernerg@uschi12devwom27: ~] $ diff testfile1 testfile2
1c1
< // $Id: one
---
> // $Id: two
[toernerg@uschi12devwom27: ~] $ diff -I '.*\$\(Id\|Header\|Date\|DateTime\|Change\|File\|Revision\|Author\):.*\$.' testfile1 testfile2
1c1
< // $Id: one
---
> // $Id: two
[toernerg@uschi12devwom27: ~] $ diff --version
diff (GNU diffutils) 2.8.1