Diff: 두 판 사이의 차이

내용 삭제됨 내용 추가됨
편집 요약 없음
편집 요약 없음
24번째 줄:
diff [원본 파일 이름 또는 원본 디렉터리 이름] [새 파일 이름 또는 새 디렉터리 이름]
이는 원본 파일이 새 파일이 될 것임을 가리킨다. 디렉터리로 지정할 경우 diff는 두 디렉터리에 존재하는 각 파일마다 차이점을 분석한다. -r 옵션을 이용하면 하부 디렉터리까지 검색한다.
 
원본 파일과 새 파일의 내용이 다음과 같다고 가정하자.
{||-
|valign="top"|  
|valign="top"|
'''원본 파일''':
'''1''' This part of the
'''2''' document has stayed the
'''3''' same from version to
'''4''' version. It shouldn't
'''5''' be shown if it doesn't
'''6''' change. Otherwise, that
'''7''' would not be helping to
'''8''' compress the size of the
'''9''' changes.
'''10'''
'''11''' This paragraph contains
'''12''' text that is outdated.
'''13''' It will be deleted in the
'''14''' near future.
'''15'''
'''16''' It is important to spell
'''17''' check this dokument. On
'''18''' the other hand, a
'''19''' misspelled word isn't
'''20''' the end of the world.
'''21''' Nothing in the rest of
'''22''' this paragraph needs to
'''23''' be changed. Things can
'''24''' be added after it.
|valign="top"|  
|valign="top"|
'''새 파일''':
'''1''' This is an important
'''2''' notice! It should
'''3''' therefore be located at
'''4''' the beginning of this
'''5''' document!
'''6'''
'''7''' This part of the
'''8''' document has stayed the
'''9''' same from version to
'''10''' version. It shouldn't
'''11''' be shown if it doesn't
'''12''' change. Otherwise, that
'''13''' would not be helping to
'''14''' compress anything.
'''15'''
'''16''' It is important to spell
'''17''' check this document. On
'''18''' the other hand, a
'''19''' misspelled word isn't
'''20''' the end of the world.
'''21''' Nothing in the rest of
'''22''' this paragraph needs to
'''23''' be changed. Things can
'''24''' be added after it.
'''25'''
'''26''' This paragraph contains
'''27''' important new additions
'''28''' to this document.
|}
 
이 경우 diff 명령은 두 개 파일의 내용을 비교하여 다음과 같은 차이점을 만들어낸다.
<source lang="diff">
0a1,6
> This is an important
> notice! It should
> therefore be located at
> the beginning of this
> document!
>
8,14c14
< compress the size of the
< changes.
<
< This paragraph contains
< text that is outdated.
< It will be deleted in the
< near future.
---
> compress anything.
17c17
< check this dokument. On
---
> check this document. On
24c24,28
< be added after it.
---
> be added after it.
>
> This paragraph contains
> important new additions
> to this document.
 
</source>
 
== 같이 보기 ==