Annotation of researchv10dc/man/adm/man1/diff.1, revision 1.1.1.1

1.1       root        1: .TH DIFF 1
                      2: .CT 1 files 
                      3: .SH NAME
                      4: diff, diff3 \- differential file comparison
                      5: .SH SYNOPSIS
                      6: .B diff
                      7: [
                      8: .I option ...
                      9: ]
                     10: .I file1 file2
                     11: .PP
                     12: .B diff3
                     13: [
                     14: .B \-ex3
                     15: ]
                     16: .I file1 file2 file3
                     17: .SH DESCRIPTION
                     18: When run on regular files
                     19: .I diff
                     20: tells what lines must be changed in the files to bring them into agreement.
                     21: Except in rare circumstances,
                     22: .I diff
                     23: finds a smallest sufficient set of differences.
                     24: If neither file
                     25: is a directory, then one
                     26: may be 
                     27: .LR - ,
                     28: meaning the standard input.
                     29: If one file
                     30: is a directory,
                     31: then a file in that directory with basename the same as that of
                     32: the other file is used.
                     33: .PP
                     34: If both files are directories,
                     35: similarly named files in the two directories
                     36: are compared by the method of
                     37: .I diff
                     38: for text files and
                     39: .IR cmp (1)
                     40: otherwise.
                     41: Options when comparing directories are:
                     42: .TP
                     43: .B -r
                     44: Apply
                     45: .I diff
                     46: recursively to similarly named subdirectories.
                     47: .TP
                     48: .B -s
                     49: Report files that are the same (normally not mentioned).
                     50: .PP
                     51: There are several options for output format;
                     52: the default output format contains lines of these forms:
                     53: .IP
                     54: .IB n1 a
                     55: .IB n3 , n4
                     56: .br
                     57: .IB n1 , n2 d
                     58: .I n3
                     59: .br
                     60: .IB n1 , n2 c
                     61: .IB n3 , n4
                     62: .PP
                     63: These lines resemble
                     64: .I ed
                     65: commands to convert
                     66: .I file1
                     67: into
                     68: .IR file2 .
                     69: The numbers after the letters pertain to
                     70: .IR file2 .
                     71: In fact, by exchanging 
                     72: .L a
                     73: for 
                     74: .L d
                     75: and reading backward
                     76: one may ascertain equally how to convert 
                     77: .I file2
                     78: into
                     79: .IR file1 .
                     80: As in 
                     81: .I ed,
                     82: identical pairs where
                     83: .IR n1 = n2
                     84: or
                     85: .I n3 = n4
                     86: are abbreviated as a single number.
                     87: .PP
                     88: Following each of these lines come all the lines that are
                     89: affected in the first file flagged by 
                     90: .LR < ,
                     91: then all the lines that are affected in the second file
                     92: flagged by 
                     93: .LR > .
                     94: .PP
                     95: Except for
                     96: .B -b,
                     97: which may be given with any of the others,
                     98: the following options are mutually exclusive:
                     99: .TP
                    100: .B -e
                    101: Produce a script of
                    102: .LR a ,
                    103: .LR c ,
                    104: and 
                    105: .L d
                    106: for
                    107: .IR ed (1)
                    108: to recreate
                    109: .I file2
                    110: from
                    111: .IR file1 .
                    112: When comparing directories, produce a
                    113: .IR sh (1)
                    114: script to convert text files common to the two directories.
                    115: .TP
                    116: .BI -c n
                    117: Include
                    118: .I n
                    119: extra lines of context with each set of differences.
                    120: The output format is modified:
                    121: the output begins with identification of the files involved and
                    122: their creation dates and changes are separated
                    123: by lines of *'s.
                    124: Lines removed from
                    125: .I file1
                    126: are marked with
                    127: .LR - ;
                    128: those added to
                    129: .I file2
                    130: are marked 
                    131: .LR + .
                    132: Lines which are changed from one
                    133: file to the other are marked in both files with 
                    134: .LR ! .
                    135: .TP
                    136: .B -h
                    137: Do a fast, half-hearted job,
                    138: useful only when changed stretches are short
                    139: and well separated,
                    140: but does work on files of unlimited length.
                    141: .TP
                    142: .B -b
                    143: Ignore trailing blanks (spaces and tabs) and treat other
                    144: strings of blanks as if they were a single space. 
                    145: .PP
                    146: .I Diff3
                    147: compares three versions of a file
                    148: and publishes the various disagreeing ranges of text.
                    149: One of the following indicators introduces each reported
                    150: difference.
                    151: .TP
                    152: .B ====
                    153: All three files differ.
                    154: .TP
                    155: .BI ==== f
                    156: File
                    157: .I f
                    158: differs, where
                    159: .I f
                    160: is 1, 2, or 3.
                    161: .PP
                    162: Disagreeing fragments from the three files follow the
                    163: .B ====
                    164: line, each identified by a
                    165: .IR diff -like
                    166: range indication:
                    167: .TP
                    168: .IB f  :  n1  a
                    169: File
                    170: .I f
                    171: lacks text that other files have; their text would
                    172: be appended after line
                    173: .I n1.
                    174: .TP
                    175: .IB f : n1 , n2 c
                    176: .br
                    177: .ns
                    178: .TP
                    179: .IB f : n1 c
                    180: Lines
                    181: .I n1
                    182: through
                    183: .I n2
                    184: (or line
                    185: .I n1
                    186: only) of file
                    187: .I f
                    188: would have to be changed to agree with some other file.
                    189: The original contents follow, unless a higher-numbered file
                    190: has the same contents.
                    191: .PP
                    192: Under option
                    193: .BR -e ,
                    194: .I diff3
                    195: publishes a script for 
                    196: .IR ed (1)
                    197: that will incorporate into
                    198: .I file1
                    199: all changes between
                    200: .I file2
                    201: and
                    202: .I file3,
                    203: i.e. the changes that normally would be flagged 
                    204: .B ====
                    205: and
                    206: .BR ====3 .
                    207: Option
                    208: .B \-x
                    209: (\fB\-3\fR)
                    210: produces a script to incorporate
                    211: only changes flagged 
                    212: .B ====
                    213: .RB ( ====3 ).
                    214: .SH EXAMPLES
                    215: .TP
                    216: .L
                    217: (cat diff0-1 diff1-2 diff2-3; echo '1,$p') | ed - file0 >file3
                    218: An ancestral
                    219: .L file0
                    220: has been kept along with a chain of version-to-version
                    221: difference files made thus:
                    222: .LR "diff -e file0 file1 >diff0-1" .
                    223: The shell command reconstructs the latest version.
                    224: .PP
                    225: .EX
                    226: if diff3 mod1 old mod2 | grep -s '^====$'
                    227: then :
                    228: else (diff3 -e mod1 old mod2; echo '1,$p') | ed - mod1 >new
                    229: fi
                    230: .EE
                    231: .PD0
                    232: .IP
                    233: Compare two different modified versions with an old file.
                    234: If no modifications interfere with each other
                    235: .RI ( grep
                    236: finds no 
                    237: .B ====
                    238: lines), make a new file incorporating both modifications.
                    239: .PD
                    240: .SH FILES
                    241: .F /tmp/d*
                    242: .br
                    243: .F /usr/lib/diffh
                    244: for 
                    245: .B -h
                    246: .br
                    247: .F /usr/lib/diff3
                    248: .SH "SEE ALSO"
                    249: .IR cmp (1),
                    250: .IR comm (1), 
                    251: .IR ed (1),
                    252: .IR idiff (1)
                    253: .SH DIAGNOSTICS
                    254: .I Diff
                    255: yields exit status is 0 for no differences, 1 for some, 2 for trouble.
                    256: .SH BUGS
                    257: Text lines that consist of a single `.' will
                    258: defeat options
                    259: .BR -e ,
                    260: .BR -x ,
                    261: and
                    262: .BR -3 .
                    263: .br
                    264: Superfluous output may result for files that differ
                    265: only in insignificant blanks when comparing directories
                    266: under option
                    267: .BR -b .
                    268: .br
                    269: Option
                    270: .B -c
                    271: is superfluous.

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.