计数bash中两个文件之间的字符差
计算两个文件中字符串之间不同字符数量的最佳方法。我知道如何在Python中执行此操作,但我需要一个bash解决方案。
文件内容:
ABCDEF
ABDCEF
输出:
2
谢谢
What would be the best way to count the number of characters that are different between strings in two files. I know how to do this in Python but I need a bash solution.
File contents:
ABCDEF
ABDCEF
Output:
2
Thank you
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
将行计数
使用
cmp
将文件与-L
的详细说明进行比较,然后用wc
:cmp -bl -bl file1 file2 | 。 wc -l </code>
http://linux.die.net/man/1/cmp
Use
cmp
to compare files with-l
for verbose, then count the lines withwc
:cmp -bl file1 file2 | wc -l
http://linux.die.net/man/1/cmp
以下有效,
The following worked,