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

前端 未结 15 2263
借酒劲吻你
借酒劲吻你 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:14

    I also wrote my own script to solve this problem using the Longest common subsequence algorithm.

    It is executed as such

    JLDiff.py a.txt b.txt out.html

    The result is in html with red and green coloring. Larger files do exponentually take a longer amount of time to process but this does a true character by character comparison without checking line by line first.

提交回复
热议问题