In this Linux tip, we’re going to look at the diff3 command. It’s similar to the diff command, but allows you to compare the contents of three text files instead of just two. In addition, the formatting of the output makes it easy to understand how the files are different. In this command, we compare three simple text files: $ diff3 file1 file2 file3 ====3 1:1,3c 2:1,3c Kids, the seven basic food groups are gum, puff pastry, pizza, pesticides, antibiotics, 3:1,3c Kids, the six basic food groups are fruits, vegetables, grains, protein and dairy The ====3 included in the output below means that the third file is different. If all the files were different, this would show just ====. The output then shows the differences between the first two files (which are the same) and the third which has a different third line. Looking at file3, we can see a 4th line. This line didn’t show up in the diff3 output because it’s the same in all three files. The diff3 command only displays differences.
Register Now
Sponsored Links