How to use the diff3 command

Published: 26 September 2024
on channel: InfoWorld
115
13

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.

How to use the diff3 command+C2
https://www.networkworld.com/video/35...

7 ways to compare text files on Linux
https://www.networkworld.com/article/...

-----------------------------­---
SUBSCRIBE:    / @infoworld  
FACEBOOK:   / infoworld  
TWITTER:   / infoworld  
WEBSITE: https://www.infoworld.com/


Watch video How to use the diff3 command online without registration, duration hours minute second in high quality. This video was added by user InfoWorld 26 September 2024, don't forget to share it with your friends and acquaintances, it has been viewed on our site 115 once and liked it 13 people.