GNU Diff的百分比值 [英] Percentage value with GNU Diff

查看:94
本文介绍了GNU Diff的百分比值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

使用diff显示两个文件之间的百分比差异的好方法是什么?

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

就像一个文件有100行,而一个副本有15行已被更改一样,差异百分比将是15%.

Such as if a file has 100 lines and a copy has 15 lines that have been changed the diff-percent would be 15%.

推荐答案

也许是这样的事情?

两个文件A1和A2.

$ sdiff -B -b -s A1 A2 | wc将为您提供多少行差异. wc给出总数,只是除.

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

-b和-B将忽略空格和空白行,-s表示禁止显示公共行.

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

这篇关于GNU Diff的百分比值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆