start page | rating of books | rating of authors | reviews | copyrights

Unix Power ToolsUnix Power ToolsSearch this book

11.5. Choosing Sides with sdiff

One problem you might be tempted to tackle with diff3 (Section 11.2) is sorting out the mess resulting 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 (Section 11.4). (Of course, the best thing to do is to prevent the problem in the first place, by using RCS or CVS (Section 39.4).)

One of the most powerful uses of sdiff is to build an output file by choosing between different versions of two files interactively. To do this, 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 and JP



Library Navigation Links

Copyright © 2003 O'Reilly & Associates. All rights reserved.