| previous | contents | up | next |
diff file1 file2
might produce the following output:
70,72c70
< #The next line had to be changed:
<
< if ($sum1 != $sum2) {
---
> if (sum1 != $sum2) {
The first and second lines listed come from file, since the
arrow points to the left. The third line comes from file2;
it has been changed. The line at the very top means indicates
where the other two lines originated. It provides context.
Almost all context diffs are applied to a subdirectory. The syntax
is then patch -pnumber < patch_name.
(That is, the file is used as redirected input to the command.)
The number depends on how deep the subdirectory lies below the
current directory. A patch will generally include instructions
for where to place it and what number to use.
6.5.3. cmp
It is also possible to find out if two files differ at all, without
looking at the differences: cmp file1
file2 exits silently if the two files are the same, but
prints out a message if they are different.
Because it exits as soon as it finds a difference, cmp is more efficient than diff. It is useful for telling if two binary files--for instance, two versions of a program--are the same.
| previous | contents | up | next |