UNIX diff Edit Script Report Example

The two files compared are:

First File Second File
1
2
3
4
5
6
7
8
9
10
11
12
13
14
Eustace, a pointy-eared hippopotamus, was
scampering across a summer meadow one day
when he suddenly came across a stream.

Sitting on a rock in the middle of the
stream was a small green frog, basking in the
afternoon sunshine.

"Hello small green 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.
Eustace, a pointy-eared hippopotamus, was
scampering across a summer meadow one day
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 blue frog, basking in the
afternoon sunshine.

"Hello small blue frog!", said Eustace. "What
are you doing there?"

The edit script created by Merge will look like the one shown below. The edit script describes the editing that must be performed to the first file to turn it into the second file. Sufficient information is contained within the report to enable the second file to be converted into the first file too.

Edit Script Explanation
5a5,7
> Eustace almost fell into the stream, but
> skidded to a halt just in time.
>
Three lines (5 through 7) from the second file need to be inserted before line 5 in the first file.
6c9
< stream was a small green frog, basking in the
---
> stream was a small blue frog, basking in the
Line 6 in the first file corresponds to line 9 in the second file, and needs to be changed from its current content (the lines prefixed with < before the --- marker) to the new content (the lines prefixed with > after the --- marker).
9c12
< "Hello small green frog!", said Eustace. "What
---
> "Hello small blue frog!", said Eustace. "What
Line 9 in the first file corresponds to line 12 in the second file, and needs to be changed from its current content (the lines prefixed with < before the --- marker) to the new content (the lines prefixed with > after the --- marker).
11,14d14
< 
< Froggy didn't answer, so Eustace trod on him
< and wandered off into the nearby forest to look
< for wild onions.
Lines 11 through 14 need to be removed from the first file.