的diff
工具在大多数系统上,而-u
统一的输出是最流行的。
$ diff -u file1 file2
--- file1 2010-07-14 02:08:20.000000000 -0700
+++ file2 2010-07-14 02:08:29.000000000 -0700
@@ -1,3 +1,3 @@
-Operating System : Windows XP
-Operating System : Windows NT
-Operating System : Windows 2008
+Windows XP
+Windows NT
+Windows2008
如果你想有一个字的字DIFF相反,你可以使用不常见的工具,如wdiff
:
$ wdiff file1 file2
[-Operating System :-]Windows XP
[-Operating System :-]
Windows NT
[-Operating System : Windows 2008-]
{+Windows2008+}
如果你想有一个更直观明显鉴于两个差异文件,您可以使用工具,如xxdiff
或 kdiff3
或类似的。 (有一个的很多三路合并图形比较工具。)
如果你想要的东西,可能会更容易编程方式使用,该cmp
程序可以在文件中列出的所有字节DIF ferences:
$ cmp -l file1 file2
1 117 127
2 160 151
3 145 156
...
cmp
对于非常接近相同的文件可能更有用。
这个问题很不清楚。它是100个文件还是两个文件,你想比较? “shell脚本”是什么意思?这是一个Unix术语;除非使用像Cygwin这样的Unix模拟环境,否则Windows只有批处理,命令和PowerShell脚本。 – 2010-07-14 08:56:50
in dir there will File1.host.pg1.txt and file1.host.pg2.txt and file1.host2.pg1.txt .... like this – Tree 2010-07-14 08:58:25
我想在linx做 – Tree 2010-07-14 09:00:52