diff和sdiff使用心得

来源:互联网 发布:淘宝客活动可以取消吗 编辑:程序博客网 时间:2024/06/13 09:14



在Linux下,有很多个文档比较工具,diff,sdiff, comm, cmp等。整体来说都不是很好用。
相对而言,还是sdiff功能比较强大一些。
Example 1: sdiff -s 1.txt 2. txt


-s:
--suppress-common-lines:
Do not print common lines


-w columns
--width=columns
Use an output width of columns. Note that for historical reasons, this option is -W in diff, -w in sdiff.


Example 1: do not print common line
[root@localhost ~]# sdiff -s 1.bashrc 2.bashrc 
# box to box deployment      |# 1004 box to box deployment
alias 109='telnet 10.74.9.109'      <
#switcher information      |# public switcher information
alias 185='ssh asr@10.74.9.185'      |
alias 190='ssh asr@10.74.9.190'      |
     > # linux virtual machine
     > alias 185='ssh -X asr@10.74.9.185'
     > alias 190='ssh -X asr@10.74.9.190'
     > alias 203='ssh asr@10.74.30.203'
     > alias 204='ssh asr@10.74.30.204'
     > alias 205='ssh asr@10.74.30.205'
[root@localhost ~]#




Example 1: specify colomn
[root@localhost ~]# sdiff -s -w 150 1.bashrc 2.bashrc 
# box to box deployment  |# 1004 box to box deployment
alias 109='telnet 10.74.9.109'  <
#switcher information  |# public switcher information
alias 185='ssh asr@10.74.9.185'  |
alias 190='ssh asr@10.74.9.190'  |
 > # linux virtual machine
 > alias 185='ssh -X asr@10.74.9.185'
 > alias 190='ssh -X asr@10.74.9.190'
 > alias 203='ssh asr@10.74.30.203'
 > alias 204='ssh asr@10.74.30.204'
 > alias 205='ssh asr@10.74.30.205'
[root@localhost ~]# 


原创粉丝点击