diff3(1)
diff3 - 3-way differential file comparison
As shipped in IRIX 6.5.30. Unchanged since IRIX 6.5.
NAME diff3 - 3-way differential file comparison SYNOPSIS diff3 [ -exEX3 [-i | -m] [-L label1 -L label3] ] file1 file2 file3 DESCRIPTION Diff3 compares three versions of a file, and publishes disagreeing ranges of text flagged with these codes: ==== all three files differ ====1 file1 is different ====2 file2 is different ====3 file3 is different The type of change suffered in converting a given range of a given file to some other is indicated in one of these ways: f : n1 a Text is to be appended after line number n1 in file f, where f = 1, 2, or 3. f : n1 , n2 c Text is to be changed in the range line n1 to line n2. If n1 = n2, the range may be abbreviated to n1. The original contents of the range follows immediately after a c indication. When the contents of two files are identical, the contents of the lower-numbered file is suppressed. The -m option produces a merge script on the output of diff3. If none of -eExX3 is specified along with -m, then the format of option -E is presumed. If the -m option is used, then binary files, files without trailing newline, and files with excessively long lines can be successfully merged. If no -m option is specified, then under the -e option, diff3 publishes a script for the editor ed(1) that will incorporate into file1 all changes between file2 and file3, i.e. the changes that normally would be flagged ==== and ====3. Option -x (-3) produces a script to incorporate only changes flagged ==== (====3). The following command will apply the resulting script to `file1', and emit the result on the output stream. (cat script; echo '1,$p') | ed - file1 The -E and -X are similar to -e and -x, respectively, but treat overlapping changes (i.e., changes that would be flagged with ==== in the normal listing) differently. The overlapping lines from both files will be inserted by the edit script, bracketed by "<<<<<<" and ">>>>>>" lines. For example, suppose lines 7-8 are changed in both file1 and file3. The merged output of the command "diff3 -m file1 file2 file3" contains: lines 1-6 of file1 <<<<<<< file1 lines 7-8 of file1 ======= lines 7-8 of file3 >>>>>>> file3 rest of file1 If there are overlaps, the user should edit the result and delete one of the alternatives. If the -L label1 and -L label3 options are given, the labels are output in place of the names file1 and file3 in overlap reports. If the option -i is specified along with one of the options -exEX3, then the resulting edit script has the editor commands w q added at the end. Then the following command will update `file1' in place with the changes. ed - file1 < script SEE ALSO diff(1), ed(1). BUGS If merges are done by generating explicit scripts to input to the editor, rather than by using the -m option, the merge is limited by the capabilities of the editor ed(1). The editor cannot handle excessively long lines, binary files (with nul bytes) or files without a trailing newline. DIAGNOSTICS An exit status of 0 means diff3 was successful, 1 means some overlaps were found, and 2 means trouble.