Yet another way to compare files is to use sdiff, which presents the two files onscreen so that you can visually compare them (see Code Listing 6.16).
[ejr@hobbes manipulate]$ sdiff dearliza → dearhenry July 25, 1998 July 25, 1998 Dear Liza, | Dear Henry, There's a hole in my bucket, dear Lisa dear Liza. | Please fix it dear Henry, dear Henry. Yours, Yours, Henry | Liza | PS,you for got your tool box last time. [ejr@hobbes manipulate]$ |
sdiff dearliza dearhenry
At the shell prompt, type sdiff and the filenames to compare the two files. The output, as shown in Code Listing 6.16, presents each line of the two files side by side, separating them with
(Nothing) if the lines are identical
< if the line exists only in the first file
> if the line exists only in the second file
| if they are different
✓ Tips
If most of the lines are the same, consider using the -s flag so the identical lines are not shown. For example, type sdiff -s dearliza dearhenry
If the output scoots by too fast to read, remember that you can pipe the entire command to more, as in sdiff dearliza dearhenry | more
3.139.86.56