|
|
1.1 ! root 1: .TH DIFF 1 "18 January 1983" ! 2: .UC 4 ! 3: .SH NAME ! 4: diff \- differential file and directory comparator ! 5: .SH SYNOPSIS ! 6: .B diff ! 7: [ ! 8: .B \-l ! 9: ] [ ! 10: .B \-r ! 11: ] [ ! 12: .B \-s ! 13: ] [ ! 14: \fB\-cefh\fR ! 15: ] [ ! 16: .B \-b ! 17: ] dir1 dir2 ! 18: .br ! 19: .B diff ! 20: [ ! 21: \fB\-cefh ! 22: ] [ ! 23: \fB\-b\fR ! 24: ] file1 file2 ! 25: .br ! 26: .B diff ! 27: [ ! 28: .BI \-D string ! 29: ] [ ! 30: .B \-b ! 31: ] ! 32: file1 file2 ! 33: .SH DESCRIPTION ! 34: If both arguments are directories, ! 35: .I diff ! 36: sorts the contents of the directories by name, and then runs the ! 37: regular file ! 38: .I diff ! 39: algorithm (described below) ! 40: on text files which are different. ! 41: Binary files which differ, ! 42: common subdirectories, and files which appear in only one directory ! 43: are listed. ! 44: Options when comparing directories are: ! 45: .TP ! 46: .B \-l ! 47: long output format; each text file ! 48: .I diff ! 49: is piped through ! 50: .IR pr (1) ! 51: to paginate it, ! 52: other differences are remembered and summarized ! 53: after all text file differences are reported. ! 54: .TP ! 55: .B \-r ! 56: causes application of ! 57: .I diff ! 58: recursively to common subdirectories encountered. ! 59: .TP ! 60: .B \-s ! 61: causes ! 62: .I diff ! 63: to report files which are the same, which are otherwise not mentioned. ! 64: .TP ! 65: .B \-Sname ! 66: starts a directory ! 67: .I diff ! 68: in the middle beginning with file ! 69: .I name. ! 70: .PP ! 71: When run on regular files, and when comparing text files which differ ! 72: during directory comparison, ! 73: .I diff ! 74: tells what lines must be changed in the files to bring them into agreement. ! 75: Except in rare circumstances, ! 76: .I diff ! 77: finds a smallest sufficient set of file differences. ! 78: If neither ! 79: .I file1 ! 80: nor ! 81: .I file2 ! 82: is a directory, then either ! 83: may be given as `\-', in which case the standard input is used. ! 84: If ! 85: .I file1 ! 86: is a directory, ! 87: then a file in that directory whose file-name is the same as the file-name of ! 88: .I file2 ! 89: is used (and vice versa). ! 90: .PP ! 91: There are several options for output format; ! 92: the default output format contains lines of these forms: ! 93: .IP "" 5 ! 94: .I n1 ! 95: a ! 96: .I n3,n4 ! 97: .br ! 98: .I n1,n2 ! 99: d ! 100: .I n3 ! 101: .br ! 102: .I n1,n2 ! 103: c ! 104: .I n3,n4 ! 105: .PP ! 106: These lines resemble ! 107: .I ed ! 108: commands to convert ! 109: .I file1 ! 110: into ! 111: .IR file2 . ! 112: The numbers after the letters pertain to ! 113: .IR file2 . ! 114: In fact, by exchanging `a' for `d' and reading backward ! 115: one may ascertain equally how to convert ! 116: .I file2 ! 117: into ! 118: .IR file1 . ! 119: As in ! 120: .I ed, ! 121: identical pairs where ! 122: .I n1 ! 123: = ! 124: .I n2 ! 125: or ! 126: .I n3 ! 127: = ! 128: .I n4 ! 129: are abbreviated as a single number. ! 130: .PP ! 131: Following each of these lines come all the lines that are ! 132: affected in the first file flagged by `<', ! 133: then all the lines that are affected in the second file ! 134: flagged by `>'. ! 135: .PP ! 136: Except for ! 137: .B \-b, ! 138: which may be given with any of the others, ! 139: the following options are mutually exclusive: ! 140: .TP 9 ! 141: .B \-e ! 142: producing a script of ! 143: .I "a, c" ! 144: and ! 145: .I d ! 146: commands for the editor ! 147: .I ed, ! 148: which will recreate ! 149: .I file2 ! 150: from ! 151: .IR file1 . ! 152: In connection with ! 153: .BR \-e , ! 154: the following shell program may help maintain ! 155: multiple versions of a file. ! 156: Only an ancestral file ($1) and a chain of ! 157: version-to-version ! 158: .I ed ! 159: scripts ($2,$3,...) made by ! 160: .I diff ! 161: need be on hand. ! 162: A `latest version' appears on ! 163: the standard output. ! 164: .IP ! 165: \ \ \ \ \ \ \ \ (shift; cat $*; echo \'1,$p\') \(bv ed \- $1 ! 166: .IP ! 167: Extra commands are added to the output when comparing directories with ! 168: .B \-e, ! 169: so that the result is a ! 170: .IR sh (1) ! 171: script for converting text files which are common to the two directories ! 172: from their state in ! 173: .I dir1 ! 174: to their state in ! 175: .I dir2. ! 176: .TP 9 ! 177: .B \-f ! 178: produces a script similar to that of ! 179: .B \-e, ! 180: not useful with ! 181: .I ed, ! 182: and in the opposite order. ! 183: .TP 9 ! 184: .B \-c ! 185: produces a diff with lines of context. ! 186: The default is to present 3 lines of context and may be changed, e.g to 10, by ! 187: .BR \-c10 \&. ! 188: With ! 189: .B \-c ! 190: the output format is modified slightly: ! 191: the output beginning with identification of the files involved and ! 192: their creation dates and then each change is separated ! 193: by a line with a dozen *'s. ! 194: The lines removed from ! 195: .I file1 ! 196: are marked with `\(mi'; those added to ! 197: .I file2 ! 198: are marked `+'. Lines which are changed from one ! 199: file to the other are marked in both files with `!'. ! 200: .TP 9 ! 201: .B \-h ! 202: does a fast, half-hearted job. ! 203: It works only when changed stretches are short ! 204: and well separated, ! 205: but does work on files of unlimited length. ! 206: .TP ! 207: .B \-Dstring ! 208: causes ! 209: .I diff ! 210: to create a merged version of ! 211: .I file1 ! 212: and ! 213: .I file2 ! 214: on the standard output, with C preprocessor controls included so that ! 215: a compilation of the result without defining \fIstring\fR is equivalent ! 216: to compiling ! 217: .I file1, ! 218: while defining ! 219: .I string ! 220: will yield ! 221: .I file2. ! 222: .TP ! 223: .B \-b ! 224: causes trailing blanks (spaces and tabs) to be ignored, and other ! 225: strings of blanks to compare equal. ! 226: .SH FILES ! 227: /tmp/d????? ! 228: .br ! 229: /usr/lib/diffh for ! 230: .B \-h ! 231: .br ! 232: /bin/pr ! 233: .SH "SEE ALSO" ! 234: cmp(1), cc(1), comm(1), ed(1), diff3(1) ! 235: .SH DIAGNOSTICS ! 236: Exit status is 0 for no differences, 1 for some, 2 for trouble. ! 237: .SH BUGS ! 238: Editing scripts produced under the ! 239: .BR \-e " or" ! 240: .BR \-f " option are naive about" ! 241: creating lines consisting of a single `\fB.\fR'. ! 242: .PP ! 243: When comparing directories with the ! 244: .B \-b ! 245: option specified, ! 246: .I diff ! 247: first compares the files ala ! 248: .I cmp, ! 249: and then decides to run the ! 250: .I diff ! 251: algorithm if they are not equal. ! 252: This may cause a small amount of spurious output if the files ! 253: then turn out to be identical because the only differences are ! 254: insignificant blank string differences.
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.