

DIFF (1)                     3/20/80                     DIFF (1)




NAME
   diff - isolate differences between files

SYNOPSIS
   diff [-{c|d|r|s|v}] <old_file> [<new_file>]

DESCRIPTION
   'Diff'  compares  the contents of two files and reports on the
   differences  between  them.   The  default  behavior   is   to
   describe  the  insert, delete, and change operations that must
   be performed on <old_file> to convert its contents into  those
   of   <new_file>.   [Editor's  note:   the  default  output  is
   evidently only  useful  at  Georgia  Tech.   The  tool  should
   generally  be called by 'diff -s' to produce an editor script,
   or 'diff -cv' to produce output similar to that  generated  by
   the tool 'cmp'.]

   The  second  file  name argument is optional.  If omitted, the
   standard input is read for the text of the <new_file>. 

   The options currently available are:

        -c   Perform  a  simple   line-by-line   comparison.
             'Diff'  will  compare  successive  lines of the
             input  files;  if   any   corresponding   lines
             differ,  or  if  one  file  is shorter than the
             other, 'diff' prints  the  message  "different"
             and  exits.   If the files are the same, 'diff'
             produces no output.  When the "-v" option  (see
             below)  is  specified,  'diff' prints the lines
             that differ along with  their  line  number  in
             the  input  file,  and notifies the user if one
             file is shorter than the other. 

        -d   List the "differences" between the  two  files,
             by  highlighting the insertions, deletions, and
             changes  that  will  convert  <old_file>   into
             <new_file>.   This  is  the default option.  If
             the  "verbose"  option  "-v"  (see  below)   is
             specified,   unchanged   text   will   also  be
             listed. 

        -r   Insert text  formatter  requests  to  mark  the
             <new_file>  with  revision  bars  and  deletion
             asterisks.  This option is particularly  useful
             for   maintenance   of  large  documents,  like
             Software   Tools   reference   manuals.     (At
             present,  only  GT's  version  of  'format' can
             produce revision bars.)

        -s   Output a "script"  of  commands  for  the  text
             editor  'ed'  that will convert <old_file> into
             <new_file>.   This  is  handy   for   preparing
             updates  to large programs or data files, since







DIFF (1)                     3/20/80                     DIFF (1)


             generally the volume of changes  required  will
             be  much  smaller  than  the  new  text  in its
             entirety. 

        -v   Make output "verbose." This option  applies  to
             the  "-c" and "-d" options discussed above.  If
             not   selected,   'diff'   produces   "concise"
             output;   if  selected,  'diff'  produces  more
             verbiage. 

   'Diff' is based on the  algorithm  found  in  Heckel,  P.,  "A
   Technique  for Isolating Differences Between Files", ____Comm. ___ACM
   21, 4 (April 1978), 264-268. 

   Examples:

   diff myfile1 myfile2
   diff rf.r nrf.r | pg
   diff -c afile maybe_the_same_file
   diff -v rf.r nrf.r | sp
   diff -r old_manual.fmt new_manual.fmt | fmt
   diff -s old new >>update_old_to_new

DIAGNOSTICS
   "<file>:  can't open" if either <new_file>  or  <old_file>  is
   not readable. 
   "Usage: diff . . ." for illegal options. 

AUTHORS
Allen Akin and friends, Georgia Institute of Technology

BUGS/DEFICIENCIES
The  algorithm  used  has  one  quirk: a line or a block of lines
which is  not  unique  within  a  file  will  be  labeled  as  an
insertion  (deletion)  if its immediately adjacent neighbors both
above and below are labeled as insertions (deletions). 

Fails on very large files (> 10000 lines). 























