Percentage value with GNU Diff

前端 未结 3 1117
孤城傲影
孤城傲影 2021-02-03 11:42

What is a good method for using diff to show a percentage difference between two files?

Such as if a file has 100 lines and a copy has 15 lines that have been changed th

3条回答
  •  醉话见心
    2021-02-03 12:19

    Something like this perhaps?

    Two files, A1 and A2.

    $ sdiff -B -b -s A1 A2 | wc would give you how many lines differed. wc gives total, just divide.

    The -b and -B are to ignore blanks and blank lines, and -s says to suppress the common lines.

提交回复
热议问题