diff sample.old sample.new
5c5
< you agree to the terms
—
> you agree to the terms and conditions
7d6
< Six ounces chopped liver
21a22
> Note: The previous version of this recipe had a few errors!
The output is actually a description of how to transform the old file into the new one. Here, diff is telling you three things:
~ The 5c5 message says to replace line 5 of the old file with line 5 of the new file. Both the old and new text are displayed, separated by a line of three dashes. (The less-than (<) notation means “remove this line,” and the greater-than (>) sign means “add this line.”)
~ The 7d6 message says to delete line 7 from the old file, and the files will then be in sync, starting at line 6 of the new file. The text to be deleted is displayed on the next line.
~ The 21a22 message says to add a new line after line 21 of the old file. The text to be added is displayed on the final line of the output.
