cez has asked for the wisdom of the Perl Monks concerning the following question:

Given two text files/strings/anything multiline,

How would one go about highlighting a change? The eventual output would be in html, but that doesn't matter. Just need to put a start and end flag on any block of changes.

For example, "The quick brown fox" and "The quick grey fox" produces The quick ***grey*** fox

It may not be as simple as per each word. It might be single characters, multiple words, multiple lines, etc.

Is there an existing script out there to do this? I looked, and couldnt find much.

Replies are listed 'Best First'.
Re: highlighting text changes
by borisz (Canon) on Jan 27, 2004 at 23:25 UTC
Re: highlighting text changes
by Roger (Parson) on Jan 28, 2004 at 01:32 UTC
    Look no further, there is a script on PM written by tachyon here -> 115928 that does (similar to) what you want. You might need to tweak it a little bit to colour the exact difference.

    Another off-the-shelf method I can think of is to use the package diff2html -
    diff2html file1 file2 > diff.html


•Re: highlighting text changes
by merlyn (Sage) on Jan 28, 2004 at 12:18 UTC
Re: highlighting text changes
by cez (Novice) on Jan 29, 2004 at 02:31 UTC
    you guys are the greatest. THANK YOU very much.