Using 'diff' (or anything else) to get character-level diff between text files

前端 未结 15 2265
借酒劲吻你
借酒劲吻你 2020-12-02 05:40

I\'d like to use \'diff\' to get a both line difference between and character difference. For example, consider:

File 1

abcde
ab         


        
15条回答
  •  执念已碎
    2020-12-02 06:10

    ccdiff is a convenient dedicated tool for the task. Here is what your example looks like with it:

    By default, it highlights the differences in color, but it can be used on a console without color support too.

    The package is included in the main repository of Debian:

    ccdiff is a colored diff that also colors inside changed lines.

    All command-line tools that show the difference between two files fall short in showing minor changes visuably useful. ccdiff tries to give the look and feel of diff --color or colordiff, but extending the display of colored output from colored deleted and added lines to colors for deleted and addedd characters within the changed lines.

提交回复
热议问题