| <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 – 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>−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>−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>−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 |
| ‘a’ for ‘d’ 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 ‘<’, then all the lines that are affected |
| in the second file flagged by ‘>’. |
| <table border=0 cellpadding=0 cellspacing=0><tr height=5><td></table> |
| |
| The <tt><font size=+1>−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>−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>−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>−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>−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>−e</font></tt> or <tt><font size=+1>−f</font></tt> option are naive about |
| creating lines consisting of a single ‘.’. |
| <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> |