home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
ftp.update.uu.se
/
ftp.update.uu.se.2014.03.zip
/
ftp.update.uu.se
/
pub
/
rainbow
/
msdos
/
decus
/
RB101
/
diff.doc
< prev
next >
Wrap
Text File
|
1995-05-19
|
4KB
|
82 lines
DIFF - A Text-file Differencing Program
This is a utility to compare two text files (e.g., two versions of
a program source file) and print the lines which differ between
them. The algorithm used is that of J. W. Hunt and M. D.
McIlroy, "An algorithm for differential file comparison", Bell
Telephone Laboratories Computing Science Technical Report #41.
Usage is
diff [option ...] file1 file2
The options, or switches, are in the UNIX style of -s -t etc. They
cannot be concatenated (e.g., -st ), but they may be used any
number of times on the command line in any order. If incompatible
switches, such as -s and -l, are both specified, the last-occurring
switch is valid.
The following options are available:
-l - "line" mode, i.e., compare files record by record,
where a record is terminated by a newline. Only the first 256
characters of the records are compared and printed. This is
the default.
-s - "sentence" mode. Here, records are terminated by a
period, colon, or semicolon. Newlines and white-space
characters are converted to spaces, and consecutive spaces are
converted to a single space. Records also end at 256
characters, but the remainder of the record is not lost;
rather, the next record starts where the previous one left
off.
-c[n1[:[n2]]] - column restriction. The comparison between
two records is restricted to columns n1 through n2. Either or
both numbers are optional; if not present, each has a default
(if n2 is present, the colon must be included). n1 defaults
to 1, n2 to 256.
-m[n1] - specifies the number of records constituting a
match; that is, if a mismatch is detected, then n1
consecutive pairs of matching lines must be found before a
match is declared again. n1 defaults to 1.
A typical invocation might be
diff -c10:20 -m3 prog.v1 prog.v2
This command would cause the files prog.v1 and prog.v2 to be
compared line by line, and those lines which differed in columns 10
through 20 would be listed in sections. A difference section would
end only when a sequence of three or more matching lines (in
columns 10 through 20) were found.
Page 2
The output of DIFF is similar to the default output of the VAX/VMS
DIFFERENCES command. However, the algorithms are not the same, and
in some unusual circumstances their sets of difference lines can
differ for the same values of the match record option. However,
the difference sets will always include all unmatched lines.
Bugs (features) in V1.30 -
The filenames must be in the current directory. This is a problem
caused by the Microsoft C compiler. A later version of Lattice C,
or somebody else's compiler, will doubtless permit filespecs
including pathnames. Watch this space.
DIFF currently has no options for output format.
DIFF will probably not be sensible about handling internal formats
used by word processors such as Wordmarc or Multi-mate.
If you have any suggestions, please contact C. K. Miller, 7613,
4-4079.
aé " σV EXE x╝.
Ç3