差异"/>
diff:比较文件的差异
diff :比较文件的差异
用法:diff [选项]... FILES
选项:-a :逐行比较-i,-ignore-case 忽略文件内容中的大小写差异-Z,--ignore-trailing-space 忽略行尾的空白-b,--ignore-space-change 忽略空白量的变化-w,--ignore-all-space 忽略所有空白-B,--ignore-blank-lines 忽略所有行均为空白的更改-r,--recursive 递归地比较找到的任何子目录-y,--by-by-side 指定宽度,并排显示-W,--width 和-y一起使用指定宽度
[root@host test]# cat file1
1
2aaabbb
ADS
[root@host test]# cat file2
12AAA
bbbads
678
• diff
[root@host test]# diff file1 file2
2c2
< 2
---
> 2
4,6c4,8
< aaa
< bbb
< ADS
---
> AAA
> bbb
>
> ads
> 678
• diff -y
[root@host test]# diff -y file1 file2
1 1
2 | 2aaa | AAAbbb | bbb
ADS |> ads> 678
• diff -y -W :指定宽度
[root@host test]# diff -y -W 30 file1 file2
1 1
2 | 2aaa | AAAbbb | bbb
ADS |> ads> 678
• diff -i :忽略大小写差异
[root@host test]# diff -i -y -W 30 file1 file2
1 1
2 | 2aaa AAAbbb | bbb>
ADS ads> 678
• diff -w :忽略所有空白的差异
[root@host test]# diff -w -y -W 30 file1 file2
1 1
2 2aaa | AAAbbb bbb
ADS |> ads> 678
------------------------------------------------------------------------------------------------------- 返回目录
更多推荐
diff:比较文件的差异
发布评论