Chinaunix首页 | 论坛 | 博客
  • 博客访问: 1572022
  • 博文数量: 289
  • 博客积分: 11086
  • 博客等级: 上将
  • 技术积分: 3291
  • 用 户 组: 普通用户
  • 注册时间: 2006-06-22 17:06
个人简介

徐小玉的博客。

文章分类

全部博文(289)

文章存档

2023年(6)

2022年(1)

2021年(2)

2020年(9)

2019年(9)

2018年(6)

2017年(10)

2016年(10)

2014年(3)

2013年(4)

2011年(12)

2010年(16)

2009年(14)

2008年(119)

2007年(48)

2006年(20)

我的朋友

分类: LINUX

2010-07-20 10:14:45

 

rcsdiff -r1.18 -r1.19 chkPackage.ksh

===================================================================

RCS file: RCS/chkPackage.ksh,v

retrieving revision 1.18

retrieving revision 1.19

diff -r1.18 -r1.19

21a22

> prflags="no"

122a124,125

>  else

>    echo "not wky"

 

 

 

 

下面的连接是官网的资料 ()

%20Normal

Detailed Description of Normal Format

The normal output format consists of one or more hunks of differences; each hunk shows one area where the files differ. Normal format hunks look like this: 

通常输出格式包含一块或多块不同,每一块显示文件不同的区域,看起来就像这样。

change-command
< from-file-line
< from-file-line...
---

> to-file-line
> to-file-line...

There are three types of change commands. Each consists of a line number or comma-separated range of lines in the first file, a single character indicating the kind of change to make, and a line number or comma-separated range of lines in the second file. All line numbers are the original line numbers in each file. The types of change commands are:

修改命令有三种类型,每个类型的命令包含第一个文件的行或点分的行范围,一个单字符表示修改的类型,第二个文件的行或者行的范围。所有的行号使用的是在每个文件中的原始的行号。修改命令类型如下:

la
Add the lines in range r of the second file after line l of the first file. For example, 8a12,15 means append lines 12-15 of file 2 after line 8 of file 1; or, if changing file 2 into file 1, delete lines 12-15 of file 2.

(添加)将第二个文件中的范围中的行添加到第一个文件的行,例如: 8a12,15 意思是将第二个文件的12-15行添加到第一个文件(l)的第8行之后。或者说,如果将文件2改为文件1,需要将文件2的12-15行删除。 

fct
Replace the lines in range f of the first file with lines in range t of the second file. This is like a combined add and delete, but more compact. For example, 5,7c8,10 means change lines 5-7 of file 1 to read as lines 8-10 of file 2; or, if changing file 2 into file 1, change lines 8-10 of file 2 to read as lines 5-7 of file 1. 
          
(修改)将第一个文件中f范围的行替换为第二个文件中的范围为t的行。这就像一个添加和删除的组合,但是更为简洁。例如:5,7c8,10 意思是将文件1的5-7行替换为第二个文件的8-10行,反过来,将第二个文件的8-10行替换为第一个文件的5-7行,可以让文件2于文件1相同。
rdl
Delete the lines in range r from the first file; line l is where they would have appeared in the second file had they not been deleted. For example, 5,7d3 means delete lines 5-7 of file 1; or, if changing file 2 into file 1, append lines 5-7 of file 1 after line 3 of file 2.
          (删除)从第一个文件中删除范围为r的行;行l是[明白意思,不知道咋说],例如:5,7d3的意思是将文件1中的5-7行删除,反过来如果要让文件2和文件1相同则将文件1中的5-7行添加到第3行之后。

以上为normal模式,另外其他几种模式,但是用的最多的应该还是normal和sidebyside模式。
  • : Showing differences without surrounding text.
  • : Showing differences with the surrounding text.
  • : Showing differences in two columns.
  • : Generating scripts for other programs.
  • : Merging files with if-then-else.
Sidebyside模式相对比较直观。
%20Side%20by%20Side

两栏中间位通过一些特殊的字符来表示关系。
white space
The corresponding lines are in common. That is, either the lines are identical, or the difference is ignored because of one of the --ignore options。什么都没有表示两边内容相同或者被忽略了不同。
|
The corresponding lines differ, and they are either both complete or both incomplete. 
       
<
The files differ and only the first file contains the line. 
           文件不同,并且只有第一个文件包含该行。
>
The files differ and only the second file contains the line. 
          文件不同,并且只有第二个文件包含该行。
(
Only the first file contains the line, but the difference is ignored. 
          仅第1个文件包含该行,但是区别被忽略。
)
Only the second file contains the line, but the difference is ignored. 
           仅第2个文件包含该行,但是区别被忽略。
\
The corresponding lines differ, and only the first line is incomplete.
/
The corresponding lines differ, and only the second line is incomplete.


例子:

This is the file lao:

The Way that can be told of is not the eternal Way;
The name that can be named is not the eternal name.
The Nameless is the origin of Heaven and Earth;
The Named is the mother of all things.
Therefore let there always be non-being,
so we may see their subtlety,
And let there always be being,
so we may see their outcome.
The two are the same,
But after they are produced,
they have different names.

This is the file tzu:

The Nameless is the origin of Heaven and Earth;
The named is the mother of all things.

Therefore let there always be non-being,
so we may see their subtlety,
And let there always be being,
so we may see their outcome.
The two are the same,
But after they are produced,
they have different names.
They both may be called deep and profound.
Deeper and more profound,
使用diff lao tuz

1,2d0
< The Way that can be told of is not the eternal Way;
< The name that can be named is not the eternal name.
4c2,3
< The Named is the mother of all things.
---
> The named is the mother of all things.
>
11a11,13
> They both may be called deep and profound.
> Deeper and more profound,
> The door of all subtleties!
1,2d0 将第一个文件的1-2行删除
4c2,3 将第一个文件的第4行改为第二个文件的2,3行
11a11,13将第二个文件的11-13行加到第一个文件的11行之后。

有很多图形化的工具可以让这样的修改更为形象化,如windiff,notepad++等,或者online的形式
以下是side2side和inline两种形式的比较结果。



阅读(1275) | 评论(0) | 转发(0) |
0

上一篇:小结实

下一篇:用眼卫生

给主人留下些什么吧!~~