GNU Diff Utility报告为文件相同的差异

时间:2014-09-03 12:35:18

标签: windows-xp diff

我在Windows XP系统中安装了 diffutils-2.8.7-1.exe

我创建了一个包含一些文本和图像的MS Office Word文档。

情景1:

Command:  diff --report-identical-files "file1.doc" "file1.doc"

它将输出显示为“相同”

Action:  Now i have copy pasted the file1.doc.

情景2:

Command:  diff --report-identical-files "file1.doc" "Copy of file1.doc"

它将输出显示为“相同”

Action:  Now i have opened the file1.doc and Save As file2.doc
         Without doing any modification in the content.
         Visually both files look identical.

情景3:

Command:  diff --report-identical-files "file1.doc" "file2.doc"

它将输出显示为“差异”

Query:  Could anyone please explain how it can happen ??
        Is diff utility checks something beyond the content of the document ??

1 个答案:

答案 0 :(得分:0)

两个.doc文件的内容相同的原因是文件中保存了其他元数据,这些元数据不同。

除非你使用一些更智能的比较工具,否则你运气不好。 diff根本不了解.doc文件格式,因此单独比较每个字节,无法忽略您认为无关紧要的内容。