DIFF utility works for 2 files. How to compare more than 2 files at a time?

丶灬走出姿态 提交于 2019-11-29 20:14:22

Displaying 10 files side-by-side and highlighting differences can be easily done with Diffuse. Simply specify all files on the command line like this:

diffuse 1.txt 2.txt 3.txt 4.txt 5.txt 6.txt 7.txt 8.txt 9.txt 10.txt

Vim can already do this:

vim -d file1 file2 file3

But you're normally limited to 4 files. You can change that by modifying a single line in Vim's source, however. The constant DB_COUNT defines the maximum number of diffed files, and it's defined towards the top of diff.c in versions 6.x and earlier, or about two thirds of the way down structs.h in versions 7.0 and up.

Peacher Wu

diff has built-in option --from-file and --to-file, which compares one operand to all others.

   --from-file=FILE1
          Compare FILE1 to all operands.  FILE1 can be a directory.

   --to-file=FILE2
          Compare all operands to FILE2.  FILE2 can be a directory.

Checkout "Beyond Compare": http://www.scootersoftware.com/

It lets you compare entire directories of files, and it looks like it runs on Linux too.

if your running multiple diff's based off one file you could probably try writing a script that has a for loop to run through each directory and run the diff. Although it wouldn't be side by side you could at least compare them quickly. hope that helped.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!