UNIX diff 編集スクリプト形式レポートの例
比較したのは以下の 2 つのファイルです。
1 Eustace, a pointy-eared hippopotamus, was
2 scampering across a summer meadow one day
3 when he suddenly came across a stream.
4
5 Sitting on a rock in the middle of the
6 stream was a small green frog, basking in the
7 afternoon sunshine.
8
9 "Hello small green frog!", said Eustace. "What
10 are you doing there?"
11
12 Froggy didn't answer, so Eustace trod on him
13 and wandered off into the nearby forest to look
14 for wild onions.
1 Eustace, a pointy-eared hippopotamus, was
2 scampering across a summer meadow one day
3 when he suddenly came across a stream.
4
5 Eustace almost fell into the stream, but
6 skidded to a halt just in time.
7
8 Sitting on a rock in the middle of the
9 stream was a small blue frog, basking in the
10 afternoon sunshine.
11
12 "Hello small blue frog!", said Eustace. "What
13 are you doing there?"
Edit script report explanation
Merge によって作成される編集スクリプトは、次のようなものになります。この編集スクリプトは、1 番目のファイルを 2 番目のファイルに変えるために、1 番目のファイルに対して行う必要がある編集内容を表しています。また、このレポートには 2 番目のファイルを 1 番目のファイルに変えるための情報も十分に含まれています。
5a5,7
> Eustace almost fell into the stream, but
> skidded to a halt just in time.
>
2 番目のファイルの 3 行(5 行目から 7 行目)を、1 番目のファイルの 5 行目の前に挿入する必要があります。
6c9
< stream was a small green frog, basking in the
---
> stream was a small blue frog, basking in the
1 番目のファイルの 6 行目は 2 番目のファイルの 9 行目に相当するため、現在の内容(— マーカーより前の、先頭に < が付いている行)を新しい内容(— マーカーより後の、先頭に > が付いている行)に変更する必要があります。
9c12
< "Hello small green frog!", said Eustace."What
---
> "Hello small blue frog!", said Eustace."What
1 番目のファイルの 9 行目は 2 番目のファイルの 12 行目に相当するため、現在の内容(— マーカーより前の、先頭に < が付いている行)を新しい内容(— マーカーより後の、先頭に > が付いている行)に変更する必要があります。
11,14d14
<
< Froggy didn't answer, so Eustace trod on him
< and wandered off into the nearby forest to look
< for wild onions.
1 番目のファイルの 11 行目から 14 行目を削除する必要があります。