|
|
1.1 root 1: .TH DIFF 1
2: .SH NAME
3: diff \- differential file comparator
4: .SH SYNOPSIS
5: .B diff
6: [
7: .B -efbwr
8: ] file1 ... file2
9: .SH DESCRIPTION
10: .I Diff
11: tells what lines must be changed in two files to bring them
12: into agreement.
13: If one file
14: is a directory,
15: then a file in that directory with basename the same as that of
16: the other file is used.
17: If both files are directories, similarly named files in the
18: two directories are compared by the method of
19: .I diff
20: for text
21: files and
22: .IR cmp (1)
23: otherwise.
24: If more than two file names are given, then each argument is compared
25: to the last argument as above.
26: The
27: .B -r
28: option causes
29: .I diff
30: to process similarly named subdirectories recursively.
31: The normal output contains lines of these forms:
32: .IP "" 5
33: .I n1
34: .B a
35: .I n3,n4
36: .br
37: .I n1,n2
38: .B d
39: .I n3
40: .br
41: .I n1,n2
42: .B c
43: .I n3,n4
44: .PP
45: These lines resemble
46: .I ed
47: commands to convert
48: .I file1
49: into
50: .IR file2 .
51: The numbers after the letters pertain to
52: .IR file2 .
53: In fact, by exchanging `a' for `d' and reading backward
54: one may ascertain equally how to convert
55: .I file2
56: into
57: .IR file1 .
58: As in
59: .IR ed ,
60: identical pairs where
61: .I n1
62: =
63: .I n2
64: or
65: .I n3
66: =
67: .I n4
68: are abbreviated as a single number.
69: .PP
70: Following each of these lines come all the lines that are
71: affected in the first file flagged by `<',
72: then all the lines that are affected in the second file
73: flagged by `>'.
74: .PP
75: The
76: .B -b
77: option causes
78: trailing blanks (spaces and tabs) to be ignored
79: and other strings of blanks to compare equal.
80: The
81: .B -w
82: option causes all white-space to be removed from input lines
83: before applying the difference algorithm.
84: .PP
85: The
86: .B -e
87: option produces a script of
88: .I "a, c"
89: and
90: .I d
91: commands for the editor
92: .IR ed ,
93: which will recreate
94: .I file2
95: from
96: .IR file1 .
97: The
98: .B -f
99: option produces a similar script,
100: not useful with
101: .IR ed ,
102: in the opposite order. It may, however, be
103: useful as input to a stream-oriented post-processor.
104: .PP
105: Except in rare circumstances,
106: .I diff
107: finds a smallest sufficient set of file
108: differences.
109: .SH FILES
110: .B /tmp/diff[12]
111: .SH SOURCE
112: .B /sys/src/cmd/diff
113: .SH "SEE ALSO"
114: .IR cmp (1),
115: .IR ed (1)
116: .SH DIAGNOSTICS
117: Exit status is the empty string
118: for no differences,
119: .L some
120: for some,
121: and
122: .L error
123: for trouble.
124: .SH BUGS
125: Editing scripts produced under the
126: .BR -e " or"
127: .BR -f " option are naive about"
128: creating lines consisting of a single `\fB.\fR'.
129: .br
130: When running
131: .I diff
132: on directories, the notion of what is a text
133: file is open to debate.
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.