[Chapter 28] 28.5 Comparing Files Alongside One Another
Author: Jerry Peek, Tim O'Reilly & Mike Loukides
Date: 1998-08-04T21:44:44Z

#

| Chapter 28 Comparing Files |

## 28.5 Comparing Files Alongside One Another

twin | sdiff (28.4) can be used to show diffed files side-by-side, so that you can compare them in context. The twin program on the CD-ROM is similar to sdiff, but it allows you to scroll through files alongside one another. twin is also nicer about wrapping lines to make the files easier to read.

The twin program displays the two files in a split screen, with line numbers in the left margin:

>     1                                 |
>      You can use the bc program to   |You can also use bc to
>       3 convert from decimal to hex.    |convert from decimal to hex.
>       4 To do so, use obase to          |To do so, use obase to
>       5 set the base for output:        |set the base for output:
>       6                                 |
>       7  obase=16                       | obase=16
>           ...

The highlighted line might be underlined on your terminal. This line is the one that twin notices is different between the files.

twin uses a limited number of commands to move around in the files, which are shown when you first start up the program. You can use the `u` command to move both files up, and the `v` command to move both files down. There are also commands for moving only one side of the screen - for example, `j` to move the right-side text down.

- LM

28.4 Side-by-Side diffs: sdiff |  | 28.6 Choosing Sides with sdiff