[comp.sources.wanted] Another kind of diff output

sena@infinet.UUCP (Fred Sena) (03/14/90)

I have a weird request.  Does anyone have a program which can compare two
files and produce as output one of the input files with the changes added and
highlighted.  Diff just shows the changes between two files, without the
similar text.

The highlighting could be like the way that mail responses are included, for
example:
>
> original mail
>
response

I want the program to compare source code versions to see what changes were
made to the code.  I suppose it could also be used to compare text files.  In
fact, I think that it would be useful for showing revisions of documents.

I don't think that this will be too difficult to write myself, but there's no
sense in re-inventing the wheel if someone has already written something.
Besides, I'm lazy.

		thanks
		--fred		sena@infinet.uucp
-- 
--------------------------------------------------
Frederick J. Sena                sena@infinet.UUCP
Memotec, Inc.  N. Andover, MA

lwall@jpl-devvax.JPL.NASA.GOV (Larry Wall) (03/16/90)

In article <2467@infinet.UUCP> sena@infinet.UUCP (Fred Sena) writes:
: I have a weird request.  Does anyone have a program which can compare two
: files and produce as output one of the input files with the changes added and
: highlighted.  Diff just shows the changes between two files, without the
: similar text.

When I want to do this I use diff -Dsymbol.  If that format doesn't appeal
to you, then you can always filter it.  If you don't have -D in diff, you
could do a similar thing with a normal diff listing and "patch -D symbol".

Larry Wall
lwall@jpl-devvax.jpl.nasa.gov

brad@SSD.CSD.HARRIS.COM (Brad Appleton) (03/19/90)

In article <2467@infinet.UUCP> sena@infinet.UUCP (Fred Sena) writes:
>I have a weird request.  Does anyone have a program which can compare two
>files and produce as output one of the input files with the changes added and
>highlighted.  Diff just shows the changes between two files, without the
>similar text.
>
>The highlighting could be like the way that mail responses are included, for
>example:
>>
>> original mail
>>
>response
>
>I want the program to compare source code versions to see what changes were
>made to the code.  I suppose it could also be used to compare text files.  In
>fact, I think that it would be useful for showing revisions of documents.
>
Some versions of diff have an option to do this (then again some dont).
If you have "sdiff" or "diffmk" on your system I would take a look at 
their manual entries.

Sdiff will produce a side-by-side (2up) list of your 2 files with the 
complete text of each. Lines shown in one file and not in the other 
are denoted by '<' or '>' and changed lines are denoted by '|'.

Diffmk will produce a 3rd file from the two compared which include 
change mark requests formatted for {n|t}roff.

Of the two (sdiff & diffmk), it sounds as if sdiff is closer to what 
you are looking for!

If you have access to an Silicon Graphics Machine ... take a look 
at "gdiff" (graphical diff). It is by far the absolute *BEST* diff 
utility that I have ever encountered (IMHO of course)!

(sorry to post but our mail aint workin well at the moment)

+=-=-=-=-=-=-=-=-= "... and miles to go before I sleep." -=-=-=-=-=-=-=-=-=-+
|  Brad Appleton                       |  Harris Computer Systems Division  |
|                                      |  2101  West  Cypress  Creek  Road  |
|      brad@ssd.csd.harris.com         |  Fort  Lauderdale, FL  33309  USA  |
|     ... {uunet | novavax}!hcx1!brad  |  MailStop 161      (305) 973-5007  |
+=-=-=-=-=-=-=-=- DISCLAIMER: I said it, not my company! -=-=-=-=-=-=-=-=-=-+

brad@SSD.CSD.HARRIS.COM (Brad Appleton) (03/20/90)

In article <2467@infinet.UUCP> sena@infinet.UUCP (Fred Sena) writes:
>I have a weird request.  Does anyone have a program which can compare two
>files and produce as output one of the input files with the changes added and
>highlighted.  Diff just shows the changes between two files, without the
>similar text.
>
>
>I want the program to compare source code versions to see what changes were
>made to the code.  I suppose it could also be used to compare text files.  In
>fact, I think that it would be useful for showing revisions of documents.
>

Look at "sdiff" and "diffmk" if they are on your system.

sdiff will compare two files sise-by-side (2up) marking lines in one 
file but not the other with '<' or '>' and marking changed lines with '|'

diffmk will produce a third file from the first two which contains 
change marks (formatted for nroff or troff)

PS -- If you have access to a Silicon Graphics machine ...
their "gdiff" is by far the best diff I have encountered.

+=-=-=-=-=-=-=-=-= "... and miles to go before I sleep." -=-=-=-=-=-=-=-=-=-+
|  Brad Appleton                       |  Harris Computer Systems Division  |
|                                      |  2101  West  Cypress  Creek  Road  |
|      brad@ssd.csd.harris.com         |  Fort  Lauderdale, FL  33309  USA  |
|     ... {uunet | novavax}!hcx1!brad  |  MailStop 161      (305) 973-5007  |
+=-=-=-=-=-=-=-=- DISCLAIMER: I said it, not my company! -=-=-=-=-=-=-=-=-=-+