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?"

Unified report explanation

Merge によって作成されるユニファイド形式レポートは、次のようなものになります。この例では、比較レポートの作成オプションで、変更行の上に付加する未変更のコンテキスト行数を 2 行と指定しています。

--- E:\temp\Eustace1.txt Sat Apr 28 00:51:11 2001
+++ E:\temp\Eustace2.txt Sat Apr 28 00:51:18 2001

最初の 2 行は比較した 2 ファイルのリストです。ファイル名の後に、そのファイルの最終更新日時を示すタイムスタンプ(ローカル時刻)が続きます。

@@ -3,12 +3,11 @@
 when he suddenly came across a stream.

+Eustace almost fell into the stream, but
+skidded to a halt just in time.
+
 Sitting on a rock in the middle of the
-stream was a small green frog, basking in the
+stream was a small blue frog, basking in the
 afternoon sunshine.

-"Hello small green frog!", said Eustace."What
+"Hello small blue frog!", said Eustace."What
 are you doing there?"
-
-Froggy didn't answer, so Eustace trod on him
-and wandered off into the nearby forest to look
-for wild onions.

このブロックは、2 番目のファイルを作成するために 1 番目のファイルから削除する必要のある行を示します。逆の場合も同様です。2 番目のファイルを作成するために 1 番目のファイルから削除する必要のある行の前には、ハイフンが付けられます。1 番目のファイルを作成するために 2 番目のファイルから削除する必要のある行の前には、プラス(+)が付けられます。変更されていないコンテキスト行の前には何も付きません。