파일 내용 비교
-b : 끝 공백, 탭 무시
-i : 대소문자 무시
-w : 모든 공백 탭 무시
man page
-b
Causes any amount of white space at the end of a line to be treated as a single newline character (the white-
space characters preceding the newline character are ignored) and other strings of white-space characters, not
including newline characters, to compare equally.
-C Lines
Produces a diff command comparison with a number of lines of context equal to the value specified by the Lines
variable. The -C flag modifies the output slightly. The output begins with identification of the files involved
and their creation dates. Each change is separated by a line with a dozen * (asterisks). The lines removed from
File1 are marked with a - (minus sign ) and those added to File2 are marked with a + (plus sign). Lines changed
from one file to the other are marked in both files with an ! (exclamation point). Changes that lie within the
specified context lines of each other are grouped together as output.
-c
Produces a diff command comparison with three lines of context. The -c flag modifies the output slightly. The
output begins with identification of the files involved and their creation dates. Each change is separated by a
line with a dozen * (asterisks). The lines removed from File1 are marked with a - (minus sign ) and those added
to File2 are marked with a + (plus sign). Lines changed from one file to the other are marked in both files
with an ! (exclamation point). Changes within the specified context lines of each other are grouped together as
output.
-D [ String ]
Causes the diff command to create a merged version of File1 and File2 on the standard output. The C
preprocessor controls are included so that a compilation of the result without defining String is equivalent to
compiling File1, while defining String yields File2.
-e
Produces output in a form suitable for use with the ed editor to convert File1 to File2. When using this flag,
the following shell program may help maintain multiple versions of a file. Only an ancestral file ($1) and a
chain of version-to-version ed scripts ($2, $3, ...) made by the diff command need to be on hand. The latest
version appears on the standard output as follows:
(shift; cat $*; echo '1,$p') | ed - $1
Extra commands are added to the output when the -e flag is used to compare directories, so the result is a
shell script for converting text files that are common to the two directories from their state in Directory1 to
their state in Directory2. Note: Editing scripts produced by the -e or -f flags cannot create lines consisting
of a single . (period).
-f
Produces output in a form not suitable for use with the ed editor, showing the modifications necessary to
convert File1 to File2 in the reverse order of that produced under the -e flag.
-h
Performs an alternate comparison that may be faster if the changed sections are short and well separated. The
-h flag works on files of any length. The -c, -C, -D, -e, -f, and -n flags cannot be used with the -h flag. All
other flags except the -b flag are ignored when used with the -h flag.
-i
Ignores the case of letters. For example, a lowercase a is treated the same as an uppercase A.
-l
Long output format. Each result from the diff command text file comparison is piped through the pr command for
pagination. Other differences are remembered and summarized after all text file differences are reported.
-n
Produces output similar to that of the -e flag, but in the opposite order and with a count of changed lines on
each insert or delete command. This is the form used by the revision control system (RCS).
-r
Causes application of the diff command recursively to common subdirectories encountered.
-s
Reports files that are the same and otherwise not mentioned.
-S [ File ]
Ignores files whose names collate before the file specified by the File variable when comparing directories.
The -S flag only applies to the directories specified in the Directory1 and Directory2 parameters. If you use
the -r flag with the -S flag, the -S flag does not work recursively in the Directory1 and Directory2
subdirectories.
-t
Expands tabs in output lines. Typical output or the -c flag output adds characters to the front of each line,
which may affect indentation of the original source lines and makes the output listing difficult to interpret.
This flag preserves the original source's indentation.
-w
Ignores all spaces and tab characters and treats all other strings of blanks as equivalent. For example, if ( a
== b ) compares equally to if(a==b).