home | O'Reilly's CD bookshelfs | FreeBSD | Linux | Cisco | Cisco Exam  


UNIX Power Tools

UNIX Power ToolsSearch this book
Previous: 28.4 Side-by-Side diffs: sdiff Chapter 28
Comparing Files
Next: 28.6 Choosing Sides with sdiff
 

28.5 Comparing Files Alongside One Another

twin
sdiff (28.4 ) can be used to show diff ed 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


Previous: 28.4 Side-by-Side diffs: sdiff UNIX Power Tools Next: 28.6 Choosing Sides with sdiff
28.4 Side-by-Side diffs: sdiff Book Index 28.6 Choosing Sides with sdiff

The UNIX CD Bookshelf NavigationThe UNIX CD BookshelfUNIX Power ToolsUNIX in a NutshellLearning the vi Editorsed & awkLearning the Korn ShellLearning the UNIX Operating System