diff 文件比较

测试数据:

[xiluhua@vm-xiluhua][~]$ cat msn.txt
aaa bbb
bbb ccc
ccc ddd
bbb eee
aaa ccc
bbb sss

[xiluhua@vm-xiluhua][~]$ cat msn.bk 
aaa bbb
BBB CCC
CCC DDD
BBB EEE
AAA CCC
BBB SSS

 

-y选项,并排的格式比较文件msn.txt和msn.bk 

-w选项,忽略空格

中间有竖线表示两边不一致

[xiluhua@vm-xiluhua][~]$ diff -yw msn.txt msn.bk 
aaa bbb                                                         aaa bbb
bbb ccc                                                       | BBB CCC
ccc ddd                                                       | CCC DDD
bbb eee                                                       | BBB EEE
aaa ccc                                                       | AAA CCC
bbb sss                                                       | BBB SSS

-c选项,上下的格式比较文件msn.txt和msn.bk 

[xiluhua@vm-xiluhua][~]$ diff -cw msn.txt msn.bk
*** msn.txt 2016-07-15 21:00:19.300146161 +0800
--- msn.bk 2016-07-16 15:01:47.385298935 +0800
***************
*** 1,6 ****
aaa bbb
! bbb ccc
! ccc ddd
! bbb eee
! aaa ccc
! bbb sss
--- 1,6 ----
aaa bbb
! BBB CCC
! CCC DDD
! BBB EEE
! AAA CCC
! BBB SSS

 

posted @ 2016-07-16 15:07  xiluhua  阅读(478)  评论(0编辑  收藏  举报