Command DIFF
Function:
Display line-by-line differences between pairs of text files.
Download:
Description:
Diff tells what lines must be changed in two files to bring them into agreement. If filename1 (filename2) is a directory, then a file in that directory with the name filename2 (filename1) is used.
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 >.
Except in rare circumstances, diff finds a smallest sufficient set of file differences.
Syntax:
DIFF [/bitw] [/c | /h] file1 file2
DIFF [/bitw] [/C number] file1 file2
DIFF [/bitw] [/D string ] file1 file2
DIFF [/bitw] [/c | /h] [/r] [/s] [/S name] directory1 directory2
| /b | Ignores trailing blanks (spaces and tabs) and treats other strings of blanks as equivalent. |
| /i | Ignores the case of letters; for example, `A' will compare equal to `a'. |
| /t | Expands TAB characters in output lines. Normal or -c output adds character(s) to the front of each line that may adversely affect the indentation of the original source lines and make the output lines difficult to interpret. This option will preserve the original source's indentation. |
| /w | Ignores all blanks (SPACE and TAB characters) and treats all other strings of blanks as equivalent; for example, `if ( a == b )' will compare equal to `if(a==b)'. |
The following options are mutually exclusive:
| /c | Produces a listing of differences with three lines of context. With this option output format is modified slightly: output begins with identification of the files involved and their creation dates, then each change is separated by a line with a dozen *'s. The lines removed from file1 are marked with '-'; those added to file2 are marked '+'. Lines that are changed from one file to the other are marked in both files with '!'. |
| /C number | Produces a listing of differences identical to that produced by -c with number lines of context. |
| /h | Does a fast, half-hearted job. It works only when changed stretches are short and well separated, but does work on files of unlimited length. Options -c, -e, -f, and -n are unavailable with -h. diff does not descend into directories with this option. |
| /D string | Creates a merged version of file1 and file2 with C preprocessor controls included so that a compilation of the result without defining string is equivalent to compiling file1, while defining string will yield file2. |
The following options are used for comparing directories:
| /r | Applies diff recursively to common subdirectories encountered. |
| /s | Reports files that are the identical; these would not otherwise be mentioned. |
| /S name | Starts a directory diff in the middle, beginning with the file name. |
Note:
- Missing newline at end of file indicates that the last line of file X did not have a new-line. If the lines are different, they will be flagged and output; although the output will seem to indicate they are the same.
|