diff:比较文件的差异

编程入门 行业动态 更新时间:2024-10-27 12:32:21

diff:比较文件的<a href=https://www.elefans.com/category/jswz/34/1768417.html style=差异"/>

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:比较文件的差异

本文发布于:2024-02-03 09:24:11,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1744579.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:差异   文件   diff

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!