开源是一种精神,分享是一种美德!

sdiff

相关命令:diff,cmp,comm,diff3
sdiff,比较两个文件并以并排的格式显示差别


用法: sdiff[选项] ...文件1 文件2 


参数:


  -o FILE  --output=FILE 互动式操作,并将结果写入到文件中.
  -i  --ignore-case   考虑大写和小写的是相同的
  -E  --ignore-tab-expansion   忽略tab变化
  -b  --ignore-space-change   忽略空格的变化
  -W  --ignore-all-space   忽略所有空格
  -B  --ignore-blank-lines   忽略空行
  -I RE  --ignore-matching-lines=RE  忽略所有匹配RE
  --strip-trailing-cr   去掉尾部回车
  -a  --text   把文件当成文本
  -w NUM  --width=NUM   最多NUM(默认130),每行的列输出
  -l  --left-column   当有两行只有左侧立柱
  -s  --suppress-common-lines   不输出公共线
  -t  --expand-tabs   把tab转成空格
  -d  --minimal   尽可能找出变化较小的一组
  -H  --speed-large-files   假设大文件和许多离散的小差异
  --diff-program=PROGRAM   使用PROGRAM比较文件.
  -v  --version   版本信息.
  --help   帮助.

[tank@localhost test1]# sdiff -a test test1     #比较二个文件的不同
1234							      \	asdfasdfas
							      >	asdfasdf


dream>cat 1.txt
1

dream>cat 1.txt.diff 
1
2
diffinfor

dream>sdiff -s 1.txt 1.txt.diff | sed -e 's#>[[:space:]]##g' -e 's/^[[:space:]]*//g' >diff.log   #比较两个文件的不同并输出过滤掉不需要的信息,把不同内容送至文本

dream>cat diff.log
2
diffinfor

评论(0)

暂无评论

评论

名字:
验证码:
获取验证码
内容: