aboutsummaryrefslogtreecommitdiff
path: root/man/man1/diff.html
blob: c5e824be8eca9028071194e959a68ed104680ee7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
<head>
<title>diff(1) - Plan 9 from User Space</title>
<meta content="text/html; charset=utf-8" http-equiv=Content-Type>
</head>
<body bgcolor=#ffffff>
<table border=0 cellpadding=0 cellspacing=0 width=100%>
<tr height=10><td>
<tr><td width=20><td>
<tr><td width=20><td><b>DIFF(1)</b><td align=right><b>DIFF(1)</b>
<tr><td width=20><td colspan=2>
    <br>
<p><font size=+1><b>NAME     </b></font><br>

<table border=0 cellpadding=0 cellspacing=0><tr height=2><td><tr><td width=20><td>

    diff &ndash; differential file comparator<br>
    
</table>
<p><font size=+1><b>SYNOPSIS     </b></font><br>

<table border=0 cellpadding=0 cellspacing=0><tr height=2><td><tr><td width=20><td>

    <tt><font size=+1>diff</font></tt> [ <tt><font size=+1>&#8722;efmnbwr</font></tt> ] file1 ... file2<br>
    
</table>
<p><font size=+1><b>DESCRIPTION     </b></font><br>

<table border=0 cellpadding=0 cellspacing=0><tr height=2><td><tr><td width=20><td>

    <i>Diff</i> tells what lines must be changed in two files to bring them
    into agreement. If one file is a directory, then a file in that
    directory with basename the same as that of the other file is
    used. If both files are directories, similarly named files in
    the two directories are compared by the method of <i>diff</i> for text
    files and
    <a href="../man1/cmp.html"><i>cmp</i>(1)</a> otherwise. If more than two file names are given, then
    each argument is compared to the last argument as above. The <tt><font size=+1>&#8722;r</font></tt>
    option causes <i>diff</i> to process similarly named subdirectories recursively.
    When processing more than one file, <i>diff</i> prefixes file differences
    with a single line listing the two differing files, in
    the form of a <i>diff</i> command line. The <tt><font size=+1>&#8722;m</font></tt> flag causes this behavior
    even when processing single files. 
    <table border=0 cellpadding=0 cellspacing=0><tr height=5><td></table>
    
    The normal output contains lines of these forms:<br>
    
    <table border=0 cellpadding=0 cellspacing=0><tr height=2><td><tr><td width=20><td>

        <i>n1</i> <tt><font size=+1>a</font></tt> <i>n3,n4<br>
        n1,n2</i> <tt><font size=+1>d</font></tt> <i>n3<br>
        n1,n2</i> <tt><font size=+1>c</font></tt> <i>n3,n4 
        <table border=0 cellpadding=0 cellspacing=0><tr height=5><td></table>
        </i>
        
    </table>
    These lines resemble <i>ed</i> commands to convert <i>file1</i> into <i>file2</i>.
    The numbers after the letters pertain to <i>file2</i>. In fact, by exchanging
    &#8216;a&#8217; for &#8216;d&#8217; and reading backward one may ascertain equally how
    to convert <i>file2</i> into <i>file1</i>. As in <i>ed</i>, identical pairs where <i>n1</i>
    = <i>n2</i> or <i>n3</i> = <i>n4</i> are abbreviated as a single number. 
    <table border=0 cellpadding=0 cellspacing=0><tr height=5><td></table>
    
    Following each of these lines come all the lines that are affected
    in the first file flagged by &#8216;&lt;&#8217;, then all the lines that are affected
    in the second file flagged by &#8216;&gt;&#8217;. 
    <table border=0 cellpadding=0 cellspacing=0><tr height=5><td></table>
    
    The <tt><font size=+1>&#8722;b</font></tt> option causes trailing blanks (spaces and tabs) to be ignored
    and other strings of blanks to compare equal. The <tt><font size=+1>&#8722;w</font></tt> option causes
    all white-space to be removed from input lines before applying
    the difference algorithm. 
    <table border=0 cellpadding=0 cellspacing=0><tr height=5><td></table>
    
    The <tt><font size=+1>&#8722;n</font></tt> option prefixes each range with <i>file</i><tt><font size=+1>:</font></tt> and inserts a space
    around the <tt><font size=+1>a</font></tt>, <tt><font size=+1>c</font></tt>, and <tt><font size=+1>d</font></tt> verbs. The <tt><font size=+1>&#8722;e</font></tt> option produces a script
    of <i>a, c</i> and <i>d</i> commands for the editor <i>ed</i>, which will recreate
    <i>file2</i> from <i>file1</i>. The <tt><font size=+1>&#8722;f</font></tt> option produces a similar script, not
    useful with <i>ed</i>, in the opposite order. It may, however, be useful
    as
    input to a stream-oriented post-processor. 
    <table border=0 cellpadding=0 cellspacing=0><tr height=5><td></table>
    
    Except in rare circumstances, <i>diff</i> finds a smallest sufficient
    set of file differences.<br>
    
</table>
<p><font size=+1><b>FILES     </b></font><br>

<table border=0 cellpadding=0 cellspacing=0><tr height=2><td><tr><td width=20><td>

    <tt><font size=+1>/tmp/diff[12]<br>
    </font></tt>
</table>
<p><font size=+1><b>SOURCE     </b></font><br>

<table border=0 cellpadding=0 cellspacing=0><tr height=2><td><tr><td width=20><td>

    <tt><font size=+1>/usr/local/plan9/src/cmd/diff<br>
    </font></tt>
</table>
<p><font size=+1><b>SEE ALSO     </b></font><br>

<table border=0 cellpadding=0 cellspacing=0><tr height=2><td><tr><td width=20><td>

    <a href="../man1/cmp.html"><i>cmp</i>(1)</a>, <a href="../man1/comm.html"><i>comm</i>(1)</a>, <a href="../man1/ed.html"><i>ed</i>(1)</a><br>
    
</table>
<p><font size=+1><b>DIAGNOSTICS     </b></font><br>

<table border=0 cellpadding=0 cellspacing=0><tr height=2><td><tr><td width=20><td>

    Exit status is the empty string for no differences, <tt><font size=+1>some</font></tt> for some,
    and <tt><font size=+1>error</font></tt> for trouble.<br>
    
</table>
<p><font size=+1><b>BUGS     </b></font><br>

<table border=0 cellpadding=0 cellspacing=0><tr height=2><td><tr><td width=20><td>

    Editing scripts produced under the <tt><font size=+1>&#8722;e</font></tt> or <tt><font size=+1>&#8722;f</font></tt> option are naive about
    creating lines consisting of a single &#8216;.&#8217;. 
    <table border=0 cellpadding=0 cellspacing=0><tr height=5><td></table>
    
    When running <i>diff</i> on directories, the notion of what is a text
    file is open to debate.<br>
    
</table>

<td width=20>
<tr height=20><td>
</table>
<!-- TRAILER -->
<table border=0 cellpadding=0 cellspacing=0 width=100%>
<tr height=15><td width=10><td><td width=10>
<tr><td><td>
<center>
<a href="../../"><img src="../../dist/spaceglenda100.png" alt="Space Glenda" border=1></a>
</center>
</table>
<!-- TRAILER -->
</body></html>