- publishing free software manuals
Comparing and Merging Files with GNU diff and patch
by David MacKenzie, Paul Eggert, and Richard Stallman
Paperback (6"x9"), 120 pages
ISBN 0954161750
RRP £12.95 ($19.95)

"Well packaged... the quality of information is excellent" --- Linux User and Developer Magazine (Issue 36, Feb 2004) Get a printed copy>>>

8.3 Generating the Merged Output Directly

With the -m or --merge option, diff3 outputs the merged file directly. This is more efficient than using ed to generate it, and works even with non-text files that ed would reject. If you specify -m without an ed script option, -A (--show-all) is assumed.

For example, the command ‘diff3 -m lao tzu tao’ (see section 7.1 A Third Sample Input File for a copy of the input files) would output the following:

<<<<<<< tzu
=======
The Way that can be told of is not the eternal Way;
The name that can be named is not the eternal name.
>>>>>>> tao
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 result.
The two are the same,
But after they are produced,
  they have different names.
<<<<<<< lao
||||||| tzu
They both may be called deep and profound.
Deeper and more profound,
The door of all subtleties!
=======

  -- The Way of Lao-Tzu, tr. Wing-tsit Chan
>>>>>>> tao
ISBN 0954161750Comparing and Merging Files with GNU diff and patchSee the print edition