diff3 (compare 3 text files, merges files)
Compares the contents of 3 text files. Displays the lines that are different. Format: diff3 file1 file2 file3
Examples: diff3 prog1 prog2 prog3
Compares prog1, prog2, and prog3. Displays the lines that differ between the files. The lines that are different in prog1 are listed after 1:, the lines that are different in prog2 are listed after 2:, and the lines that are different in prog3 are listed after 3:. For example: cat fileA
John Smith
Alice Brown
John Huang
cat fileB
Bob Smith
Alice in Wonderland
John Huang
cat fileC
Bob Smith
Alice Brown
John Huang
diff fileA fileB fileC
1:
John Smith
Alice Brown
2:
Bob Smith
Alice in Wonderland
3:
Bob Smith
Alice Brown
Opt | What It Does | Example |
---|
-m | Merge changes. See man page | diff3 -m file1 file2 file3 | |