Next: , Previous: Marking Conflicts, Up: diff3 Merging


8.3 Generating the Merged Output Directly

With the --merge (-m) 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 is assumed.

For example, the command ‘diff3 -m lao tzu tao’ (see Sample diff3 Input 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