72 lines · 2.3 KB · Text
RawDownload
= diff: differential file comparator  *diff* [ *-efbwr* ] file1 ... file2  _Diff_ tells what lines must be changed in two files to bring them intoagreement. If one file is a directory, then a file in that directorywith basename the same as that of the other file is used. If both filesare directories, similarly named files in the two directories arecompared by the method of _diff_ for text files and _cmp_(1) otherwise.If more than two file names are given, then each argument is compared tothe last argument as above. The *-r* option causes _diff_ to processsimilarly named subdirectories recursively. The normal output containslines of these forms: * _n1_ *a* _n3,n4_ +_n1,n2_ *d* _n3_ +_n1,n2_ *c* _n3,n4_ These lines resemble Plan 9 or Unix _ed_ commands to convert _file1_into _file2_. The numbers after the letters pertain to _file2_. In fact,by exchanging `a' for `d' and reading backward one may ascertain equallyhow to convert _file2_ into _file1_. As in _ed_, identical pairs where_n1_ = _n2_ or _n3_ = _n4_ are abbreviated as a single number. Following each of these lines come all the lines that are affected inthe first file flagged by `<', then all the lines that are affected inthe second file flagged by `>'. The *-b* option causes trailing blanks (spaces and tabs) to be ignoredand other strings of blanks to compare equal. The *-w* option causes allwhite-space to be removed from input lines before applying thedifference algorithm. The *-e* option produces a script of _a, c_ and _d_ commands for thePlan 9 or Unix editor _ed_, which will recreate _file2_ from _file1_.The *-f* option produces a similar script, not useful with _ed_, in theopposite order. It may, however, be useful as input to a stream-orientedpost-processor. Except in rare circumstances, _diff_ finds a smallest sufficient set offile differences. == FILES */tmp/diff[12]* == SOURCE */appl/cmd/diff.b* == DIAGNOSTICS Exit status is the empty string for no differences, for some, and for trouble. == SEE ALSO _cmp_(1) == BUGS Editing scripts produced under the *-e* or *-f* option are naive aboutcreating lines consisting of a single `**.**'. +When running _diff_ on directories, the notion of what is a text file isopen to debate. +Nothing directly interprets the _ed_ scripts within the Infernoenvironment.