diff file1 file2
是否列出和diff file1 file2
之间的所有不同行,包括所有不可打印的字符?file1
file2
答案1
是的,它将打印两个文件之间的所有不同行,除非该文件中的任何一个都包含二进制字符。
示例:
使用空格:
echo 'difftest ' > diff1
echo 'difftest' > diff2
diff diff1 diff2
输出:
1c1
< difftest
---
> difftest
和新队:
echo 'difftest ' > diff1
echo 'difftest\n' > diff2
diff diff1 diff2
输出:
1c1,2
< difftest
---
> difftest
>
和二进制字符(无效的):
echo 'difftest\0' > diff1
echo 'difftest' > diff2
diff diff1 diff2
输出:
Binary files diff1 and diff2 differ