Finding differences in files with sdiff
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).
To compare files with sdiff:
- At the shell prompt, type sdiff and the file names 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
sdiff dearliza dearhenry
(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
Tip
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.
Tip
If the output ...
Get Unix: Visual QuickStart Guide now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.