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


UNIX Power Tools

UNIX Power ToolsSearch this book
Previous: 28.5 Comparing Files Alongside One Another Chapter 28
Comparing Files
Next: 28.7 diff for Very Long Files: bdiff
 

28.6 Choosing Sides with sdiff

One problem you might be tempted to tackle with diff3 ( 28.2 ) is sorting out the mess that can happen if two people make copies of the same file, and then make changes to their copies. You often find that one version has some things right and another version has other things right. What if you wanted to compile a single version of this document that reflects the changes made to each copy? You want to select which version is correct for each set of differences. An effective way to do this would be to use sdiff ( 28.4 ) . (Of course, the best thing to do is to prevent the problem in the first place, by using SCCS or RCS ( 20.12 ) .)

One of the most powerful uses of sdiff is to build an output file by interactively choosing between different versions of two files. To do this, you have to specify the -o option and the name of an output file to be created. The sdiff command then displays a % prompt after each set of differences.

You can compare the different versions and select the one that will be sent to the output file. Some of the possible responses are l to choose the left column, r to choose the right column, and q to exit the program.

- TOR , JP


Previous: 28.5 Comparing Files Alongside One Another UNIX Power Tools Next: 28.7 diff for Very Long Files: bdiff
28.5 Comparing Files Alongside One Another Book Index 28.7 diff for Very Long Files: bdiff

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