Path: utzoo!utgpu!water!watmath!clyde!att!ucbvax!hplabs!hp-pcd!hpcvlx!squires From: squires@hpcvlx.HP.COM (Matt Squires) Newsgroups: comp.software-eng Subject: Re: Looking for a program to merge two files interactively Message-ID: <910002@hpcvlx.HP.COM> Date: 23 Jul 88 18:46:28 GMT References: Organization: Hewlett-Packard Co., Corvallis, OR, USA Lines: 44 / hpcvlx:comp.software-eng / pratt@paul.rutgers.edu (Lorien Y. Pratt) / 4:54 am Jul 22, 1988 / > ... What I would like is: > 1) A two-up listing of each file which is different, showing where the > differences are and what they are. > 2) An interactive program which will take as input the two different files, > and for each section which is different, prompt me interactively > as to whether one or the other or both should be included in a > third, output file. I would also like an option to flag a block > of just-included text so that I can look at it later and make > modifications in an editor. Perhaps you might want to look at "idiff", a program developed in section 6.8 of Kernighan + Pike's THE UNIX PROGRAMMING ENVIRONMENT (C) 1984. "idiff" does not quite match your "flagging" specs, but here is their description: "A common problem is to have two versions of a file, somewhat different, each containing part of a desired file; this often results when changes are made independently by two different people. diff(1) will tell you how the files differ, but it's of no direct help if you want to select some parts of the first file and some of the second. In this section, we will write a program idiff ("interactive diff") that presents each chunk of diff output and offers the user the option of choosing the "from" part, choosing the "to" part, or editing the parts. idiff produces the selected pieces in the proper order, in a file called idiff.out." The editor idiff uses is ed(1), but it is trivial to modify that to a different editor, such as mg(1) or emacsclient(1). When a section of differing text is brought into the editor, the diff(1) output of the differing sections is loaded. Thus, you can merge the section of differing code yourself, or insert your own "flags" at the beginning and end of the text yourself, using the editor. The code is written in C for a Unix programming environment, and is about 3 pages long. I stongly recommend THE UNIX PROGRAMMING ENVIRONMENT for everybody who uses Unix beyond reading and sending mail. mcs