MathGroup Archive 2004

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: comparing big notebooks with diff

  • To: mathgroup at
  • Subject: [mg45469] Re: [mg45344] comparing big notebooks with diff
  • From: Dale Horton <daleh at>
  • Date: Fri, 9 Jan 2004 05:20:36 -0500 (EST)
  • Sender: owner-wri-mathgroup at

At 04:54 AM 1/1/2004, Christopher Purcell wrote:
>Too frequently I have to search for unintended changes I have made in
>large notebooks. If I am lucky I have a previous version to compare
>with. Here is an interface to the Unix (and Mac OSX) diff command,
>which I find useful, since it can compare huge files very fast. It
>would be great if some Notebook wizard would take this routine and add
>the possibility of opening both files being compared in nicely
>sized/positioned windows and color highlighting the differences. This
>also works on Windows if the Cygwin Unix emulator is installed. If not,
>the DOS command FC could probably be substituted for diff.
>diff::usage="diff[file1,file2] provides an interface to the diff
>routine on Unix-like operating systems. The following command:
>Partition[diff[file1,file2],4] ],1] ],{2}]]
>extracts just the pairs of line numbers of the files,that could be used
>as pointers if they were read with something like:
>Here is an example of usage:
>\"This statement is false\">>junk1.txt
>\"This statement is true\">>junk2.txt
>diff[\"junk1.txt\",\"junk2.txt\"] ";
>Module[{log},(Run["diff"<>" "<> file1<>" "<> file2<>">"<>"diff.log"] ;
>Christopher Purcell
>Sensors & Actuators Group
>DRDC-Atlantic, 9 Grove St., PO Box 1012,
>Dartmouth NS B2Y 3Z7 Canada
>Tel 902-426-3100 x389
>Fax 902-426-9654

In v5, there is such a function, NotebookDiff, in AuthorTools.
-Go to the menu File>Palettes>Open AuthorTools.
-Press NotebookDiff.
-Press Notebooks...
-In the dialog press Select (to select an open notebook) or Browse (to 
select a notebook file) for the 2 notebooks.
-Press compare

This creates a new notebook with a list of the differences. If you select 
the triangle to the left of a difference it will show you the cells that 
are different.

If you want to see the differences in context, press the link for that 
difference. It will show the 2 original notebooks side-by-side with the 
cells highlighted. The list of differences are now at the bottom of the 
screen. You can also use this side-by-side view to apply changes from one 
notebook to the other.


  • Prev by Date: Definitive Mathematical Functions Site Now Online
  • Next by Date: Re: 2^20991011-1
  • Previous by thread: comparing big notebooks with diff
  • Next by thread: Re: Compile