diff3 [ -e | -x | -E | -X | -3 ] File1 File2 File3
The diff3 command
compares three files and writes to standard output the ranges of text that
differ, flagged with the following codes:
==== | All three files differ. |
====1 | File1 differs. |
====2 | File2 differs. |
====3 | File3 differs. |
The type of change needed to
convert a given range of a given file to match another file is indicated in
one of these two ways in the output:
The contents of the range follows a c indication. When the contents of two files are identical, the diff3 command does not show the contents of the lower-numbered file, although it shows the location of the identical lines for each.
Note: Edit scripts produced by the -e flag cannot create lines consisting of a . (period).
-3 | Produces an edit script to incorporate only changes flagged ====3. |
-E, -X | These are similar to -e and -x respectively, but treat overlapping changes (that is, changes that would be flagged ==== in the normal listing) differently. The overlapping lines from both files are inserted by the edit script, bracketed by <<<<<< and >>>>>> lines. The -E option is used by Revision Control System (RCS) Merge to ensure that overlapping changes in the merged files are preserved and brought to someone's attention. |
-e | Creates an edit script for use with the ed command to incorporate into File1 all changes between File2 and File3 (that is, the changes that normally would be flagged ==== and ====3). |
-x | Produces an edit script to incorporate only changes flagged ====. |
To list the differences among three files:
diff3 fruit.a fruit.b fruit.c
If fruit.a, fruit.b, and fruit.c contain the following data:
fruit.a fruit.b fruit.c banana apple grape grape banana grapefruit kiwi grapefruit kiwi lemon kiwi lemon mango orange mango orange peach orange peach pear peach pare
then the output from the diff3 command shows the differences between these files as follows. (The comments on the right do not appear in the output.)
==== All three files are different. 1:1,2c Lines 1 and 2 of the first file, fruit.a banana grape 2:1,3c Lines 1 through 3 of fruit.b apple banana grapefruit 3:1,2c Lines 1 and 2 of fruit.c grape grapefruit ====2 The second file, fruit.b, is different. 1:4,5c Lines 4 and 5 the same in fruit.a and fruit.c. 2:4a To make fruit.b look same, add after line 4. 3:4,5c lemon mango ==== The first file, fruit.a, is different. 1:8c pare 2:7c fruit.b line 7 and fruit.c line 8 are the same pear 3:7a
/usr/bin/diff3 | Indicates the diff3 command. |
/usr/lbin/diff3prog | Called by the diff3 shell script. |
Files Overview in AIX 5L Version 5.1 System User's Guide: Operating System and Devices introduces you to files and the way you can work with them.
Input and Output Redirection Overview in AIX 5L Version 5.1 System User's Guide: Operating System and Devices describes how the operating system processes input and output.