UNIX in a Nutshell: System V Edition

UNIX in a Nutshell: System V EditionSearch this book
Previous: Reference: diff3Chapter 2
Unix Commands
Next: Reference: dircmp
 

diffmk

diffmk oldfile newfile markedfile

A useful program for reviewing changes between drafts of a document. diffmk compares two versions of a file (oldfile and newfile) and creates a third file (markedfile) that contains troff "change mark" requests. When markedfile is formatted with nroff or troff, the differences between the two files are marked in the margin (via the .mc request). diffmk uses a | to mark changed lines and a * to mark deleted lines. Note that change marks are produced even if the changes are inconsequential (e.g., extra blanks, different input line lengths).

Example

To run diffmk on multiple files, it's convenient to set up directories in which to keep the old and new versions of your files, and to create a directory in which to store the marked files:

$ mkdir OLD NEW CHANGED

Move your old files to OLD and your new files to NEW. Then use this rudimentary Bourne shell script:

$ cat do.mark
for file
do
   echo "Running diffmk on $file ..."
   diffmk ../OLD/$file $file ../CHANGED/$file
done

You must run the script in the directory of new files:

$ cd NEW
$ do.mark Ch*


Previous: Reference: diff3UNIX in a Nutshell: System V EditionNext: Reference: dircmp
Reference: diff3Book IndexReference: dircmp

The UNIX CD Bookshelf NavigationThe UNIX CD BookshelfUNIX Power ToolsUNIX in a NutshellLearning the vi Editorsed & awkLearning the Korn ShellLearning the UNIX Operating System