问题描述
我喜欢一些帮助一个Bash脚本循环,会显示所有两个二进制文件之间的差异,只用
I would love some help with a Bash script loop that will show all the differences between two binary files, using just
cmp file1 file2
只显示第一个变化,我想是因为它给人的每个变化是一个偏移的行号使用CMP但如果你认为有更好的命令我打开它:)谢谢
It only shows the first change I would like to use cmp because it gives a offset an a line number of where each change is but if you think there's a better command I'm open to it :) thanks
推荐答案
我觉得 CMP -l文件1文件2
可能会做你想要什么。从手册页:
I think cmp -l file1 file2
might do what you want. From the manpage:
-l --verbose
Output byte numbers and values of all differing bytes.
的输出是在文件1的偏移,字节值和所有不同字节file2中的值的表。它看起来是这样的:
The output is a table of the offset, the byte value in file1 and the value in file2 for all differing bytes. It looks like this:
4531 66 63
4532 63 65
4533 64 67
4580 72 40
4581 40 55
[...]
所以,第一个区别是在偏移量4531,其中文件1的小数字节值是66和file2的是63。
So the first difference is at offset 4531, where file1's decimal byte value is 66 and file2's is 63.
这篇关于使用" CMP"比较两个二进制的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!