Lines Matching +full:two +full:-
1 .Dd 2015-03-02
9 Computer users often find occasion to ask how two files differ. Perhaps one
10 file is a newer version of the other file. Or maybe the two files started
15 command to show differences between two files, or each corresponding file
16 in two directories.
26 normally produces no output; for binary (non-text) files,
32 command to show the byte and line numbers where two files differ.
34 can also show all the bytes that differ between the two files, side by side.
35 A way to compare two files character by character is the Emacs command
36 .Li M-x compare-windows .
42 command to show differences among three files. When two people have made independent
45 can report the differences between the original and the two changed versions,
51 command to merge two files interactively.
80 Vol. 1 No. 2, 1986, pp. 251--266; and in \(lqA File Comparison Program\(rq, Webb Miller
82 .Em Software---Practice and Experience
83 Vol. 15 No. 11, 1985, pp. 1025--1040. The algorithm was independently discovered
86 Vol. 64, 1985, pp. 100--118. Unless the
87 .Op --minimal
97 Elsevier/MIT Press, 1990, pp. 255--300.
114 There are several ways to think about the differences between two files. One
118 compares two files line by line, finds groups of lines that differ, and reports
133 Another way to think of the differences between two files is as a sequence
136 reports the differences between two files byte by byte, instead of line by
141 is useful mainly when you want to know only whether two files are identical,
151 will report that almost every byte of the two files differs.
156 to make it easy to inspect two different sets of changes to the same file.
159 When comparing two files,
164 Comparing two identical files yields one sequence of common lines and no hunks,
165 because no lines differ. Comparing two entirely different files yields no
167 general, there are many ways to match up lines between two given files.
192 .Bd -literal -offset indent
207 .Bd -literal -offset indent
210 ---
214 ---
225 .Op -d
227 .Op --minimal
233 .Op -E
235 .Op --ignore-tab-expansion
241 .Op -b
243 .Op --ignore-space-change
248 considers the following two lines to be equivalent, where
252 .Bd -literal -offset indent
253 Here lyeth muche rychnesse in lytell space. -- John Heywood$
254 Here lyeth muche rychnesse in lytell space. -- John Heywood $
258 .Op -w
260 .Op --ignore-all-space
268 considers the following two lines to be equivalent, where
274 .Bd -literal -offset indent
275 Here lyeth muche rychnesse in lytell space.-- John Heywood$
276 He relyeth much erychnes seinly tells pace. --John Heywood ^M$
281 .Op -B
283 .Op --ignore-blank-lines
286 .Bd -literal -offset indent
290 -- Euclid, The Elements, I
293 .Bd -literal -offset indent
298 -- Euclid, The Elements, I
303 .Op -b
305 .Op --ignore-space-change
307 .Op -w
309 .Op --ignore-all-space
312 .Op -B
314 .Li -I '^$'
316 .Op -I '^[[:space:]]*$'
318 .Op -b
320 .Op -w
327 .Op -I Va regexp
329 .Op --ignore-matching-lines= Va regexp
332 .Li diff -I '^[[:digit:]]'
336 .Op -I
338 if every changed line in the hunk---every insertion and every deletion---matches
346 .Op -I
361 .Op -i
363 .Op --ignore-case
372 .Op -q
374 .Op --brief
377 This format is especially useful when comparing the contents of two directories.
382 You can also get a brief indication of whether two files differ by using
390 .Op -s ,
391 .Op --quiet ,
393 .Op --silent
403 cannot compare directories; it can only compare two files.
408 thinks that either of the two files it is comparing is binary (a non-text
418 several thousand. If every byte in that part of the file is non-null,
427 would erroneously decide that those are non-text files. Or you might be comparing
433 .Op -a
435 .Op --text
445 .Op -q
447 .Op --brief
455 .Op -a
457 .Op --text
459 .Op -q
461 .Op --brief
469 .Op --binary
472 to read and write binary data instead. This option has no effect on a POSIX-compliant
479 .Op --binary
484 when dealing with non-text files that are meant to be interchanged with POSIX-compliant
488 .Op --strip-trailing-cr
497 If you want to compare two files byte by byte, you can use the
500 .Op -l
502 .Op --verbose
503 option to show the values of each differing byte in the two files. With GNU
506 .Op -b
508 .Op --print-bytes
515 thinks that any of the files it is comparing is binary (a non-text file),
522 if the input files contain a few non-text bytes but otherwise are like text
527 .Op -a
529 .Op --text
537 reports the differences between two sample input files.
539 .Ss Two Sample Input Files
540 Here are two sample files that we will use in numerous examples to illustrate
548 .Bd -literal -offset indent
553 Therefore let there always be non-being,
557 The two are the same,
565 .Bd -literal -offset indent
569 Therefore let there always be non-being,
573 The two are the same,
581 In this example, the first hunk contains just the first two lines of
599 provides two output formats that show context around the differing lines:
630 .Op -C Va lines ,
631 .Op --context[= Va lines] ,
633 .Op -c
641 typically needs at least two lines of context.
646 .Li diff -c lao tzu
649 for the complete contents of the two files). Notice that up to three lines
651 are the context lines. Also notice that the first two hunks have run together,
654 .Bd -literal -offset indent
655 *** lao 2002-02-21 23:30:39.942229878 -0800
656 --- tzu 2002-02-21 23:30:50.442260588 -0800
659 - The Way that can be told of is not the eternal Way;
660 - The name that can be named is not the eternal name.
663 Therefore let there always be non-being,
666 --- 1,6 ----
670 Therefore let there always be non-being,
675 --- 8,13 ----
676 The two are the same,
687 .Li diff -C 1 lao tzu
690 for the complete contents of the two files). Notice that at most one context
693 .Bd -literal -offset indent
694 *** lao 2002-02-21 23:30:39.942229878 -0800
695 --- tzu 2002-02-21 23:30:50.442260588 -0800
698 - The Way that can be told of is not the eternal Way;
699 - The name that can be named is not the eternal name.
702 Therefore let there always be non-being,
703 --- 1,4 ----
707 Therefore let there always be non-being,
710 --- 10,13 ----
719 The context output format starts with a two-line header, which looks like
722 .Bd -literal -offset indent
723 *** from-file from-file-modification-time
724 --- to-file to-file-modification time
728 .Li 2002-02-21 23:30:39.942229878 -0800
730 .Lk ftp://ftp.isi.edu/in-notes/rfc2822.txt .
742 .Op --label= Va label
748 .Bd -literal -offset indent
750 *** from-file-line-numbers ****
751 from-file-line
752 from-file-line...
753 --- to-file-line-numbers ----
754 to-file-line
755 to-file-line...
758 If a hunk contains two or more lines, its line numbers look like
763 The lines of context around the lines that differ start with two space characters.
764 The lines that differ between the two files start with one of the following
767 .Bl -tag -width Ds
778 .It -
784 .Va from-file
786 .Va to-file
794 .Op -U Va lines ,
795 .Op --unified[= Va lines] ,
797 .Op -u
814 .Li diff -u lao tzu
817 for the complete contents of the two files):
819 .Bd -literal -offset indent
820 --- lao 2002-02-21 23:30:39.942229878 -0800
821 +++ tzu 2002-02-21 23:30:50.442260588 -0800
822 @@ -1,7 +1,6 @@
829 Therefore let there always be non-being,
832 @@ -9,3 +8,6 @@
833 The two are the same,
843 The unified output format starts with a two-line header, which looks like
846 .Bd -literal -offset indent
847 --- from-file from-file-modification-time
848 +++ to-file to-file-modification-time
852 .Li 2002-02-21 23:30:39.942229878 -0800
857 .Op --label= Va label
864 .Bd -literal -offset indent
865 @@ from-file-line-numbers to-file-line-numbers @@
866 line-from-either-file
867 line-from-either-file...
875 If a hunk and its context contain two or more lines, its line numbers look
882 actually differ between the two files have one of the following indicator
885 .Bl -tag -width Ds
889 .It -
908 .Op -F Va regexp
910 .Op --show-function-line= Va regexp
920 .Bl -tag -width Ds
937 .Op -F
939 .Op --show-function-line
951 .Op -p
953 .Op -F
960 .Op -p
962 .Op --show-c-function
967 .Op -C Va lines
970 .Op -U Va lines
974 .Op -p
976 .Op --show-c-function
978 .Op -F '^[[:alpha:]$_]'
980 .Op -c -F '^[[:alpha:]$_]'
989 If you are comparing two files that have meaningless or uninformative names,
994 .Op --label= Va label
1000 .Op --label
1004 .Op -l
1006 .Op --paginate
1010 Here are the first two lines of the output from
1011 .Li diff -C 2 --label=original --label=modified lao tzu :
1013 .Bd -literal -offset indent
1015 --- modified
1020 can produce a side by side difference listing of two files. The files are
1021 listed in two columns with a gutter between them. The gutter contains one
1024 .Bl -tag -width Ds
1028 .Op --ignore
1058 However, when an output line represents two differing lines, one might be
1081 .Op -y
1083 .Op --side-by-side
1088 .Op -W Va columns
1090 .Op --width= Va columns
1091 option. The output is split into two halves of equal width, separated by a
1097 .Op --left-column
1098 option prints only the left column of two common lines. The
1099 .Op --suppress-common-lines
1105 .Li diff -y -W 72 lao tzu
1108 for the complete contents of the two files).
1110 .Bd -literal -offset indent
1120 The two are the same, The two are the same,
1144 .Op --normal
1153 for the complete contents of the two files). Notice that it shows only the
1154 lines that are different between the two files.
1156 .Bd -literal -offset indent
1162 ---
1177 .Bd -literal -offset indent
1178 change-command
1179 < from-file-line
1180 < from-file-line...
1181 ---
1182 > to-file-line
1183 > to-file-line...
1187 comma-separated range of lines in the first file, a single character indicating
1188 the kind of change to make, and a line number or comma-separated range of
1192 .Bl -tag -width Ds
1200 means append lines 12--15 of file 2 after line 8 of file 1; or, if changing
1201 file 2 into file 1, delete lines 12--15 of file 2.
1211 means change lines 5--7 of file 1 to read as lines 8--10 of file 2; or, if
1212 changing file 2 into file 1, change lines 8--10 of file 2 to read as lines
1213 5--7 of file 1.
1223 means delete lines 5--7 of file 1; or, if changing file 2 into file 1, append
1224 lines 5--7 of file 1 after line 3 of file 2.
1229 .Va from-file
1231 .Va to-file .
1243 .Op -e
1245 .Op --ed
1257 .Li diff -e old new ,
1259 .Li (cat d && echo w) | ed - old
1270 .Li diff -e old new1 ,
1271 .Li diff -e new1 new2 ,
1273 .Li diff -e newN-1 newN ,
1275 .Li (cat d1 d2 ... dN && echo w) | ed - old
1284 .Li diff -e lao tzu
1287 for the complete contents of the two files):
1289 .Bd -literal -offset indent
1314 .Bd -literal -offset indent
1315 change-command
1316 to-file-line
1317 to-file-line...
1328 command to change the two periods into one. The
1336 comma-separated range of lines in the first file and a single character indicating
1340 .Bl -tag -width Ds
1354 means change lines 5--7 of file 1 to read as the text file 2.
1361 means delete lines 5--7 of file 1.
1388 .Op -f
1390 .Op --forward-ed
1398 .Op -n
1400 .Op --rcs
1421 .Li diff -n lao tzu
1424 for the complete contents of the two files):
1426 .Bd -literal -offset indent
1438 .Ss Merging Files with If-then-else
1441 to merge two files of C source code. The output of
1456 To merge two files, use
1459 .Op -D Va name
1461 .Op --ifdef= Va name
1473 .Li waitpid (-1, &s, 0)
1475 .Op --ifdef=HAVE_WAITPID
1478 .Bd -literal -offset indent
1483 if ((w = waitpid (-1, &s, 0)) < 0 && errno != EINTR)
1495 that allow if-then-else input, including programming languages and text formatting
1505 -
1509 -
1513 .Bd -literal -offset indent
1515 --old-group-format='\ebegin{em}
1518 --new-group-format='\ebegin{bf}
1527 .Bd -literal -offset indent
1529 --old-group-format='\ebegin{em}
1532 --new-group-format='\ebegin{bf}
1535 --unchanged-group-format='%=' \e
1536 --changed-group-format='\ebegin{em}
1547 .Bd -literal -offset indent
1549 --unchanged-group-format=\(rq \e
1550 --old-group-format='-------- %dn line%(n=1?:s) deleted at %df:
1552 --new-group-format='-------- %dN line%(N=1?:s) added after %de:
1554 --changed-group-format='-------- %dn line%(n=1?:s) changed at %df:
1555 %<-------- to:
1567 .Bl -tag -width Ds
1568 .It --old-group-format= Va format
1571 specified; otherwise it is a format that outputs the line group as-is.
1573 .It --new-group-format= Va format
1576 otherwise it is a format that outputs the line group as-is.
1578 .It --changed-group-format= Va format
1582 .It --unchanged-group-format= Va format
1584 group format is a format that outputs the line group as-is.
1592 .Bl -tag -width Ds
1618 stands for a colon, even inside the then-part of an if-then-else format, which
1643 .Bl -tag -width Ds
1663 -
1685 .Li -
1686 for left-justification,
1740 of a line group in if-then-else format.
1742 For example, the following command outputs text with a one-character change
1744 .Li -
1750 .Bd -literal -offset indent
1752 --old-line-format='-%l
1754 --new-line-format='|%l
1756 --unchanged-line-format=' %l
1765 .Bl -tag -width Ds
1766 .It --old-line-format= Va format
1769 .It --new-line-format= Va format
1772 .It --unchanged-line-format= Va format
1775 .It --line-format= Va format
1784 .Bl -tag -width Ds
1849 .Op -t
1851 .Op --expand-tabs
1861 .Bd -literal -offset indent
1863 --old-line-format='< %l
1865 --new-line-format='> %l
1867 --old-group-format='%df%(f=l?:,%dl)d%dE
1869 --new-group-format='%dea%dF%(F=L?:,%dL)
1871 --changed-group-format='%df%(f=l?:,%dl)c%dF%(F=L?:,%dL)
1872 %<---
1874 --unchanged-group-format=\(rq \e
1878 .Em An Example of If-then-else Format
1881 .Li diff -DTWO lao tzu
1884 for the complete contents of the two files):
1886 .Bd -literal -offset indent
1887 #ifndef TWO
1890 #endif /* ! TWO */
1892 #ifndef TWO
1894 #else /* TWO */
1897 #endif /* TWO */
1898 Therefore let there always be non-being,
1902 The two are the same,
1905 #ifdef TWO
1909 #endif /* TWO */
1912 .Em Detailed Description of If-then-else Format
1931 .Op --ifdef= Va name
1934 .Bd -literal -offset indent
1935 --old-group-format='#ifndef name
1938 --new-group-format='#ifdef name
1941 --unchanged-group-format='%=' \e
1942 --changed-group-format='#ifndef name
1951 .Op -D Va name
1953 .Op --ifdef= Va name
1970 .Op -D Va name
1973 .Op -D Va name
1978 When an input file ends in a non-newline character, its last line is called
1992 outputs the incomplete line as-is, without any trailing newline or following
1993 line. The side by side format normally represents incomplete lines as-is,
2000 The if-then-else line format preserves a line's incompleteness with
2020 are one-byte files that contain just
2028 .Bd -literal -offset indent
2032 ---
2037 (The exact message may differ in non-English locales.)
2038 .Li diff -n F G
2041 .Bd -literal -offset indent
2047 .Li diff -e F G
2048 reports two errors and outputs the following:
2050 .Bd -literal -offset indent
2059 to compare some or all of the files in two directory trees. When both file
2069 .Op -s
2071 .Op --report-identical-files
2076 .Op -r
2078 .Op --recursive
2091 .Op -N
2093 .Op --new-file
2098 .Op --unidirectional-new-file
2100 .Op -N .
2102 .Op -N
2111 .Op -x Va pattern
2113 .Op --exclude= Va pattern
2121 .Op -x '*.[ao]'
2129 .Op -x 'RCS' -x '*,v'
2137 .Op -X Va file
2139 .Op --exclude-from= Va file
2142 If you have been comparing two directories and stopped partway through, later
2144 .Op -S Va file
2146 .Op --starting-file= Va file
2151 If two directories differ only in that file names are lower case in one directory
2156 .Op --ignore-file-name-case
2165 .Op --no-ignore-file-name-case
2167 .Op --ignore-file-name-case
2171 .Op -x Va pattern
2173 .Op --exclude= Va pattern
2175 .Op -X Va file
2177 .Op --exclude-from= Va file
2179 .Op --ignore-file-name-case
2191 output formats are preceded by one or two characters that indicate whether
2196 provides two ways to make tab-aligned columns line up correctly.
2202 .Op -t
2204 .Op --expand-tabs
2210 .Op -l
2212 .Op --ignore-white-space
2219 .Op --tabsize= Va columns
2230 .Op -T
2232 .Op --initial-tab
2236 It can be convenient to have long output page-numbered and time-stamped. The
2237 .Op -l
2239 .Op --paginate
2245 .Li diff -lc lao tzu :
2247 .Bd -literal -offset indent
2248 2002-02-22 14:20 diff -lc lao tzu Page 1
2262 normally does not need to read two hard or symbolic links to the same file,
2265 .Li diff -r
2266 to compare the original to the copy. If the original files are read-only,
2269 .Li cp -lR
2271 .Li cp -sR ) .
2284 determines which lines have changed always comes up with a near-minimal set
2291 .Op -d
2293 .Op --minimal
2300 .Op --speed-large-files
2314 run faster, but occasionally it may produce non-minimal output. The
2315 .Op --horizon-lines= Va lines
2346 Hunks are labeled depending on whether they are two-way or three-way, and
2357 and how various options can change it. The first two files are the same that
2365 .Bd -literal -offset indent
2371 Therefore let there always be non-being,
2375 The two are the same,
2379 -- The Way of Lao-Tzu, tr. Wing-tsit Chan
2390 .Bd -literal -offset indent
2418 -- The Way of Lao-Tzu, tr. Wing-tsit Chan
2424 Three-way hunks have plain
2426 lines, and two-way hunks have
2432 hunks contain copies of two or three sets of input lines each preceded by
2433 one or two commands identifying where the lines came from.
2435 Normally, two spaces precede each copy of an input line to distinguish it
2437 .Op -T
2439 .Op --initial-tab
2442 uses a tab instead of two spaces; this lines up tabs correctly.See Section
2448 .Bl -tag -width Ds
2467 is a comma-separated pair of line numbers, or just one number if the range
2481 Groups of lines that differ in two or three of the input files are called
2490 .Em three-way hunk
2491 ; if just two input files differ, it is a
2492 .Em two-way hunk .
2504 hunks by merging the two-way hunks output by the two commands
2531 .Bd -literal -offset indent
2547 because it found a two-way hunk containing
2553 common to all three files, then a three-way hunk containing the last line
2557 When two people have made changes to copies of the same file,
2569 to merge three or more sets of changes to a file by merging two change sets
2573 can incorporate changes from two modified versions into a common preceding
2574 version. This lets you merge the sets of changes represented by the two newer
2578 .Bd -literal -offset indent
2597 This merging is well-defined as long as
2634 .Op -e
2636 .Op --ed
2638 .Op -3
2640 .Op --easy-only ,
2642 .Op -x
2644 .Op --overlap-only .
2647 .Op -e ,
2648 .Op -3
2650 .Op -x
2667 .Op -A
2669 .Op --show-all
2678 .Op -e
2680 .Op -3
2682 .Op -x .
2685 .Li diff3 -e lao tzu tao :
2686 .Bd -literal -offset indent
2689 -- The Way of Lao-Tzu, tr. Wing-tsit Chan
2697 .Li diff3 -3 lao tzu tao :
2698 .Bd -literal -offset indent
2705 .Li diff3 -x lao tzu tao :
2706 .Bd -literal -offset indent
2709 -- The Way of Lao-Tzu, tr. Wing-tsit Chan
2716 lines. A conflict that comes from two files
2722 .Bd -literal -offset indent
2737 .Bd -literal -offset indent
2748 .Op -A
2750 .Op --show-all
2752 .Op -e
2759 .Li diff3 -A lao tzu tao
2764 .Bd -literal -offset indent
2772 And it outputs the three-way conflict as follows:
2774 .Bd -literal -offset indent
2782 -- The Way of Lao-Tzu, tr. Wing-tsit Chan
2787 .Op -E
2789 .Op --show-overlap
2791 .Op -A
2793 .Op --show-all
2796 .Op -E
2798 .Op -e
2799 option, except that it brackets the first and third files from three-way overlapping
2801 .Op -X
2803 .Op -x ,
2805 for the three-way overlapping change above, the
2806 .Op -E
2808 .Op -X
2811 .Bd -literal -offset indent
2815 -- The Way of Lao-Tzu, tr. Wing-tsit Chan
2821 .Op --label= Va label
2829 .Li diff3 -A --label X --label Y --label Z A B C
2831 .Li diff3 -A A B C ,
2845 .Op -m
2847 .Op --merge
2852 to generate it, and works even with non-text files that
2855 .Op -m
2859 .Op -A
2863 .Li diff3 -m lao tzu tao
2868 .Bd -literal -offset indent
2876 Therefore let there always be non-being,
2880 The two are the same,
2890 -- The Way of Lao-Tzu, tr. Wing-tsit Chan
2896 .Op -m ,
2909 .Op -m ,
2932 .Op -i
2942 .Op -i
2946 .Op -AeExX3 ,
2948 .Op -m .
2953 you can merge two files interactively based on a side-by-side
2954 .Op -y
2958 .Op -o Va file
2960 .Op --output= Va file
2979 .Bd -literal -offset indent
2980 -a -b -d -i -t -v
2981 -B -E -I regexp
2983 --expand-tabs
2984 --ignore-blank-lines --ignore-case
2985 --ignore-matching-lines=regexp --ignore-space-change
2986 --ignore-tab-expansion
2987 --left-column --minimal --speed-large-files
2988 --strip-trailing-cr --suppress-common-lines
2989 --tabsize=columns --text --version --width=columns
2995 .Op -l
2997 .Op --left-column
2999 .Op -s
3001 .Op --suppress-common-lines .
3004 .Op -w
3006 .Op -W
3011 .Op -w Va columns
3013 .Op --width= Va columns ,
3015 .Op -W
3017 .Op --ignore-all-space .
3020 .Op -o
3024 .Op -y
3026 .Op --side-by-side
3039 .Bl -tag -width Ds
3045 Concatenate the two versions, edit the result in a temporary file, then copy
3082 environment variable if it is set. The default is system-dependent.
3142 .Bl -tag -width Ds
3143 .It -c
3144 .It --context
3147 .It -e
3148 .It --ed
3152 .It -n
3153 .It --normal
3156 .It -u
3157 .It --unified
3169 also asks when the input file is read-only and matches the default version
3173 .Op -g Va num
3175 .Op --get= Va num
3211 .Li -
3213 .Li -
3215 .Lk ftp://ftp.isi.edu/in-notes/rfc934.txt ,
3229 .Op -l
3231 .Op --ignore-white-space
3236 in the input files. Non-blank characters must still match exactly. Each line
3247 .Op -R
3249 .Op --reverse
3262 .Op -R
3275 thinks it is a reversed patch and offers to un-apply the patch. This could
3277 to un-apply the patch, just answer
3279 to this offer and to the subsequent \(lqapply anyway\(rq question---or type
3280 .Li C-c
3306 the first two and last two lines of context are ignored. It continues similarly
3310 .Op -F Va lines
3312 .Op --fuzz= Va lines
3338 .Op --verbose
3381 .Op --dry-run
3394 .Op --dry-run
3398 Sometimes when comparing two directories, a file may exist in one directory
3402 .Op -N
3404 .Op --new-file
3407 or is empty and is dated the Epoch (1970-01-01 00:00:00 UTC),
3417 .Op -E
3419 .Op --remove-empty-files
3432 updates a file, it normally sets the file's last-modified time stamp to the
3454 .Op -Z
3456 .Op --set-utc
3465 .Op -T
3467 .Op --set-time
3469 .Op -Z
3471 .Op --set-utc ,
3475 local time stamps are ambiguous when local clocks move backwards during daylight-saving
3478 .Op -Z
3480 .Op --set-utc .
3484 last-modified time stamp does not match the time given in the diff header,
3486 .Op -f
3488 .Op --force
3520 .Bl -bullet
3526 .Op -p Va num
3528 .Op --strip= Va num
3555 .Bl -bullet
3600 .Op -d Va directory
3602 .Op --directory= Va directory
3609 .Op -B
3611 .Op -o ) .
3616 .Bd -literal -offset indent
3617 | patch -d /usr/src/emacs
3623 .Op -p Va number
3625 .Op --strip= Va number
3639 .Op -p0
3641 .Op -p1
3645 .Op -p4
3649 .Op -p
3656 .Op -d Va directory
3665 .Li patch -R
3674 .Op -b
3676 .Op --backup
3681 .Op --backup-if-mismatch
3686 .Op --no-backup-if-mismatch
3706 .Op -z Va backup-suffix
3708 .Op --suffix= Va backup-suffix
3712 .Va backup-suffix
3733 .Op -V Va backup-style
3735 .Op --version-control= Va backup-style
3742 .Op -V
3753 .Op -V
3755 .Li version-control
3762 .Bl -tag -width Ds
3781 .Op -B Va prefix
3783 .Op --prefix= Va prefix
3787 .Op -Y Va prefix
3789 .Op --basename-prefix= Va prefix
3793 .Op -Y ~
3798 If you use either of these prefix options, the suffix-based options are ignored.
3801 .Op -o
3806 .Op --no-backup-if-mismatch
3825 .Op -r Va reject-file
3827 .Op --reject-file= Va reject-file
3829 .Va reject-file
3852 .Op --verbose
3863 .Op -s ,
3864 .Op --quiet ,
3866 .Op --silent
3871 There are two ways you can prevent
3874 .Op -f
3876 .Op --force
3881 .Bl -bullet
3895 .Op -t
3897 .Op --batch
3899 .Op -f ,
3902 .Bl -bullet
3905 .Op -f ) .
3923 .Op --quoting-style= Va word
3928 .Bl -tag -width Ds
3930 Output names as-is.
3934 .It shell-always
3941 except omit the surrounding double-quote characters.
3945 .Op --quoting-style
3955 .Op --posix
3962 .Bl -bullet
4000 .Bl -bullet
4005 .Op -p
4007 .Op -p
4009 .Op -p0 .
4011 .Op -p
4013 .Op -p 0
4015 .Op -p0 .
4017 .Op -p0
4019 .Op -p1 .
4035 .Op -b
4037 .Op --backup
4045 .Op --no-backup-if-mismatch
4049 .Op -b Va suffix
4053 .Li -b -z Va suffix
4065 is optionally POSIX-conforming; we hope it has fewer gotchas. The two methods
4068 line are all identical after prefix-stripping. Your patch is normally compatible
4105 .Bd -literal -offset indent
4123 subject, instead of one large, harder-to-digest patch that covers all the
4134 archives of the two versions.
4137 .Li diff -Naur Va old Va new
4147 .Op -N
4149 .Op -a
4150 lets the patch update non-text files;
4151 .Op -u
4153 .Op -r
4157 .Bd -literal -offset indent
4158 diff -Naur gcc-3.0.3 gcc-3.0.4
4165 .Li -p1
4191 .Op -p Va number
4196 .Bd -literal -offset indent
4197 diff -Naur v2.0.29/prog/README prog/README
4198 --- v2.0.29/prog/README 2002-03-10 23:30:39.942229878 -0800
4199 +++ prog/README 2002-03-17 20:49:32.442260588 -0800
4202 because the two file names have different numbers of slashes, and different
4208 .Bd -literal -offset indent
4209 diff -Naur v2.0.29/prog/README v2.0.30/prog/README
4210 --- v2.0.29/prog/README 2002-03-10 23:30:39.942229878 -0800
4211 +++ v2.0.30/prog/README 2002-03-17 20:49:32.442260588 -0800
4258 .Li diff -Naur
4264 between the two versions, make a list of
4281 .Op -x Va pattern
4291 .Li diff -Naur .
4304 typically needs at least two lines for proper operation when patches do not
4310 command compares two files, and if they differ, tells the first byte and line
4316 .Bd -literal -offset indent
4317 cmp options... from-file [to-file [from-skip [to-skip]]]
4321 .Pa -
4325 .Va from-skip
4327 .Va to-skip
4330 .Op --ignore-initial= Va from-skip: Va to-skip
4335 outputs nothing if the two files have the same contents. If one file is a
4340 .Bd -literal -offset indent
4341 cmp: EOF on shorter-file
4348 .Bd -literal -offset indent
4349 from-file to-file differ: char byte-number, line line-number
4361 accepts. Most options have two equivalent names, one of which is a single
4363 .Li - ,
4365 .Li -- .
4368 .Op -bl
4370 .Op -b -l .
4372 .Bl -tag -width Ds
4373 .It -b
4374 .It --print-bytes
4379 .Li M-
4382 .It --help
4385 .It -i Va skip
4386 .It --ignore-initial= Va skip
4394 .Op Va from-skip: Va to-skip ,
4396 .Va from-skip
4398 .Va to-skip
4401 .It -l
4402 .It --verbose
4406 .It -n Va count
4407 .It --bytes= Va count
4412 .It -s
4413 .It --quiet
4414 .It --silent
4418 .It -v
4419 .It --version
4437 .Op -n 4M
4439 .Op -n 4MiB
4441 .Op -n 4194304 ,
4443 .Op -n 4MB
4445 .Op -n 4000000 .
4447 .Lk http://www.bipm.fr/enus/3_SI/si-prefixes.html
4455 .Bl -tag -width Ds
4465 and the IEC 60027-2 prefix is
4502 is a GNU extension to IEC 60027-2.)
4509 is a GNU extension to IEC 60027-2.)
4517 .Bd -literal -offset indent
4521 In the simplest case, two file names
4522 .Va from-file
4524 .Va to-file
4528 .Va from-file
4530 .Va to-file .
4532 .Pa -
4534 .Li diff - -
4539 compares the file in the directory whose name is that of the non-directory.
4540 The non-directory file must not be
4541 .Pa - .
4543 If two file names are given and both are directories,
4547 .Op -r
4549 .Op --recursive
4557 .Op --from-file= Va file
4561 .Op --to-file= Va file
4567 .Li - ,
4569 .Li - .
4571 .Op --
4574 .Li - .
4579 .Op -a
4581 .Op --text
4583 .Op -q
4585 .Op --brief
4591 accepts. Most options have two equivalent names, one of which is a single
4593 .Li - ,
4595 .Li -- .
4598 .Op -ac
4600 .Op -a -c .
4604 .Bl -tag -width Ds
4605 .It -a
4606 .It --text
4607 Treat all files as text and compare them line-by-line, even if they do not
4611 .It -b
4612 .It --ignore-space-change
4616 .It -B
4617 .It --ignore-blank-lines
4621 .It --binary
4625 .It -c
4629 .It -C Va lines
4630 .It --context[= Va lines]
4639 typically needs at least two lines of context.
4644 .Op - Va lines
4646 .Op -c
4648 .Op -p .
4649 POSIX 1003.1-2001 (see Section
4652 .Op -C Va lines
4655 .It --changed-group-format= Va format
4658 to output a line group containing differing lines from both files in if-then-else
4662 .It -d
4663 .It --minimal
4669 .It -D Va name
4670 .It --ifdef= Va name
4675 See Section.Dq If-then-else .
4677 .It -e
4678 .It --ed
4684 .It -E
4685 .It --ignore-tab-expansion
4689 .It -f
4690 .It --forward-ed
4696 .It -F Va regexp
4697 .It --show-function-line= Va regexp
4703 .It --from-file= Va file
4710 .It --help
4713 .It --horizon-lines= Va lines
4721 .It -i
4722 .It --ignore-case
4723 Ignore changes in case; consider upper- and lower-case letters equivalent.See Section
4726 .It -I Va regexp
4727 .It --ignore-matching-lines= Va regexp
4732 .It --ignore-file-name-case
4736 .It -l
4737 .It --paginate
4743 .It --label= Va label
4753 .It --left-column
4754 Print only the left column of two common lines in side by side format.See Section
4757 .It --line-format= Va format
4760 to output all input lines in if-then-else format.See Section
4763 .It -n
4764 .It --rcs
4765 Output RCS-format diffs; like
4766 .Op -f
4770 .It -N
4771 .It --new-file
4776 .It --new-group-format= Va format
4779 to output a group of lines taken from just the second file in if-then-else
4783 .It --new-line-format= Va format
4786 to output a line taken from just the second file in if-then-else format.See Section
4789 .It --old-group-format= Va format
4792 to output a group of lines taken from just the first file in if-then-else
4796 .It --old-line-format= Va format
4799 to output a line taken from just the first file in if-then-else format.See Section
4802 .It -p
4803 .It --show-c-function
4807 .It -q
4808 .It --brief
4812 .It -r
4813 .It --recursive
4817 .It -s
4818 .It --report-identical-files
4819 Report when two files are the same.See Section
4822 .It -S Va file
4823 .It --starting-file= Va file
4829 .It --speed-large-files
4834 .It --strip-trailing-cr
4838 .It --suppress-common-lines
4842 .It -t
4843 .It --expand-tabs
4848 .It -T
4849 .It --initial-tab
4854 .It --tabsize= Va columns
4860 .It --to-file= Va file
4867 .It -u
4871 .It --unchanged-group-format= Va format
4874 to output a group of common lines taken from both files in if-then-else format.See Section
4877 .It --unchanged-line-format= Va format
4880 to output a line common to both files in if-then-else format.See Section
4883 .It --unidirectional-new-file
4885 of the two, treat it as present but empty in the other.See Section
4888 .It -U Va lines
4889 .It --unified[= Va lines]
4898 typically needs at least two lines of context.
4903 .Op - Va lines
4905 .Op -u .
4906 POSIX 1003.1-2001 (see Section
4909 .Op -U Va lines
4912 .It -v
4913 .It --version
4916 .It -w
4917 .It --ignore-all-space
4921 .It -W Va columns
4922 .It --width= Va columns
4928 .It -x Va pattern
4929 .It --exclude= Va pattern
4935 .It -X Va file
4936 .It --exclude-from= Va file
4942 .It -y
4943 .It --side-by-side
4954 .Bd -literal -offset indent
4964 .Pa - ,
4979 .Bl -tag -width Ds
4980 .It -a
4981 .It --text
4982 Treat all files as text and compare them line-by-line, even if they do not
4986 .It -A
4987 .It --show-all
4997 .It --diff-program= Va program
5003 .It -e
5004 .It --ed
5015 .It -E
5016 .It --show-overlap
5018 .Op -e ,
5022 .Op -E ,
5025 .Bd -literal -offset indent
5033 .It --help
5036 .It -i
5045 .Op -AeExX3
5047 .Op -m .
5050 .It --label= Va label
5054 .Op -A ,
5055 .Op -E
5057 .Op -X
5060 .Li diff3 --label X --label Y --label Z -m A B C
5062 .Li diff3 -m A B C ,
5075 .It -m
5076 .It --merge
5083 .Op -A
5087 .It --strip-trailing-cr
5091 .It -T
5092 .It --initial-tab
5093 Output a tab rather than two spaces before the text of a line in normal format.
5097 .It -v
5098 .It --version
5101 .It -x
5102 .It --overlap-only
5104 .Op -e ,
5108 .It -X
5110 .Op -E ,
5112 .Op -x ,
5114 .Op -E .
5117 .It -3
5118 .It --easy-only
5120 .Op -e ,
5130 .Bd -literal -offset indent
5138 .Bd -literal -offset indent
5143 .Op -i Va patchfile
5145 .Op --input= Va patchfile
5151 .Pa - ,
5174 .Op -o Va file
5176 .Op --output= Va file
5189 Multiple single-letter options that do not take an argument can be combined
5192 .Bl -tag -width Ds
5193 .It -b
5194 .It --backup
5199 .It -B Va prefix
5200 .It --prefix= Va prefix
5206 .It --backup-if-mismatch
5211 .It --binary
5214 This option has no effect on POSIX-conforming systems like GNU/Linux. On systems
5216 .Li diff -a --binary .
5219 .It -c
5220 .It --context
5224 .It -d Va directory
5225 .It --directory= Va directory
5232 .It -D Va name
5233 .It --ifdef= Va name
5234 Make merged if-then-else output using
5236 See Section.Dq If-then-else .
5238 .It --dry-run
5242 .It -e
5243 .It --ed
5249 .It -E
5250 .It --remove-empty-files
5254 .It -f
5255 .It --force
5260 .It -F Va lines
5261 .It --fuzz= Va lines
5266 .It -g Va num
5267 .It --get= Va num
5275 .It --help
5278 .It -i Va patchfile
5279 .It --input= Va patchfile
5285 .It -l
5286 .It --ignore-white-space
5291 .It -n
5292 .It --normal
5296 .It -N
5297 .It --forward
5301 .Op -R .
5304 .It --no-backup-if-mismatch
5309 .It -o Va file
5310 .It --output= Va file
5316 .It -p Va number
5317 .It --strip= Va number
5322 .It --posix
5328 .It --quoting-style= Va word
5337 .It -r Va reject-file
5338 .It --reject-file= Va reject-file
5340 .Va reject-file
5344 .It -R
5345 .It --reverse
5349 .It -s
5350 .It --quiet
5351 .It --silent
5355 .It -t
5356 .It --batch
5360 .It -T
5361 .It --set-time
5367 .It -u
5368 .It --unified
5372 .It -v
5373 .It --version
5376 .It -V Va backup-style
5377 .It --version=control= Va backup-style
5381 .It --verbose
5385 .It -x Va number
5386 .It --debug= Va number
5391 .It -Y Va prefix
5392 .It --basename-prefix= Va prefix
5398 .It -z Va suffix
5399 .It --suffix= Va suffix
5408 .It -Z
5409 .It --set-utc
5418 command merges two files and interactively outputs the results. Its arguments
5421 .Bd -literal -offset indent
5422 sdiff -o outfile options... from-file to-file
5426 .Va from-file
5428 .Va to-file ,
5432 .Va from-file
5434 .Va to-file
5438 .Va from-file
5440 .Va to-file ,
5442 .Va from-file
5444 .Va to-file
5449 .Li - ,
5451 .Va from-file
5453 .Va to-file
5455 .Li - .
5457 .Op --
5460 .Li - .
5462 .Pa -
5467 .Op -o
5469 .Op --output )
5470 produces a side-by-side difference. This usage is obsolete; use the
5471 .Op -y
5473 .Op --side-by-side
5484 accepts. Each option has two equivalent names, one of which is a single letter
5486 .Li - ,
5488 .Li -- .
5493 .Bl -tag -width Ds
5494 .It -a
5495 .It --text
5496 Treat all files as text and compare them line-by-line, even if they do not
5500 .It -b
5501 .It --ignore-space-change
5505 .It -B
5506 .It --ignore-blank-lines
5510 .It -d
5511 .It --minimal
5517 .It --diff-program= Va program
5523 .It -E
5524 .It --ignore-tab-expansion
5528 .It --help
5531 .It -i
5532 .It --ignore-case
5533 Ignore changes in case; consider upper- and lower-case to be the same.See Section
5536 .It -I Va regexp
5537 .It --ignore-matching-lines= Va regexp
5542 .It -l
5543 .It --left-column
5544 Print only the left column of two common lines.See Section
5547 .It -o Va file
5548 .It --output= Va file
5553 .It -s
5554 .It --suppress-common-lines
5558 .It --speed-large-files
5563 .It --strip-trailing-cr
5567 .It -t
5568 .It --expand-tabs
5573 .It --tabsize= Va columns
5579 .It -v
5580 .It --version
5583 .It -w Va columns
5584 .It --width= Va columns
5590 .Op -W
5593 .Op -w
5597 .It -W
5598 .It --ignore-all-space
5602 .Op -w
5605 .Op -W
5620 .Li diff lao tzu -C 2
5622 .Li diff -C 2 lao tzu ,
5625 is an option-argument of
5626 .Op -C .
5634 .Li diff -c -10
5636 .Li diff -C 10 ,
5637 but POSIX 1003.1-2001
5639 no longer allows digit-string options like
5640 .Op -10 .
5648 specifying the year and month the standard was adopted. Two values are currently
5652 stands for POSIX 1003.2-1992, and
5654 stands for POSIX 1003.1-2001. For example, if you are running older software
5656 .Li diff -c -10 ,
5688 .Em Handling Multibyte and Varying-Width Characters
5702 incorrect in some locales, e.g., locales that use UTF-8 encoding. This causes
5704 .Op -y
5706 .Op --side-by-side
5714 .Lk http://oss.software.ibm.com/developer/opensource/linux/patches/i18n/diffutils-2.7.2-i18n-0.1.pa…
5729 .Li diff -r
5755 treats symbolic links as if they were the pointed-to files, except that a
5769 outputs the difference between the two files, instead of the change to the
5780 .Li diff -r
5798 to a multiple-file diff can result in files whose time stamps are out of order.
5811 It would be nice to have a feature for specifying two strings, one in
5812 .Va from-file
5814 .Va to-file ,
5815 which should be considered to match. Thus, if the two strings are
5819 then if two lines differ only in that
5830 .Bd -literal -offset indent
5831 sed 's/foo/bar/g' file1 | diff - file2
5838 When comparing two large directory structures, one of which was originally
5840 .Li cp -pR ) ,
5843 to assume that two files with the same size and time stamps have the same
5855 .Lk http://mail.gnu.org/mailman/listinfo/bug-gnu-utils
5856 .Mt bug-gnu-utils@gnu.org .
5860 .Mt bug-patch@gnu.org .
5863 .Op --version
5872 .Bd -filled -offset indent
5874 Suite 330, Boston, MA 02111-1307, USA
5880 .Bl -enum
5910 the terms of this License. Such a notice grants a world-wide, royalty-free
5921 A \(lqSecondary Section\(rq is a named appendix or a front-matter section of the Document
5937 The \(lqCover Texts\(rq are certain short passages of text that are listed, as Front-Cover
5938 Texts or Back-Cover Texts, in the notice that says that the Document is released
5939 under this License. A Front-Cover Text may be at most 5 words, and a Back-Cover
5942 A \(lqTransparent\(rq copy of the Document means a machine-readable copy, represented
5956 available DTD, and standard-conforming simple HTML, PostScript or PDF designed
5960 and/or processing tools are not generally available, and the machine-generated
6005 clearly and legibly, all these Cover Texts: Front-Cover Texts on the front
6006 cover, and Back-Cover Texts on the back cover. Both covers must also clearly
6019 than 100, you must either include a machine-readable Transparent copy along
6020 with each Opaque copy, or state in or with each Opaque copy a computer-network
6021 location from which the general network-using public has access to download
6022 using public-standard network protocols a complete Transparent copy of the
6044 .Bl -enum
6119 If the Modified Version includes new front-matter sections or appendices that
6127 but endorsements of your Modified Version by various parties---for example,
6131 You may add a passage of up to five words as a Front-Cover Text, and a passage
6132 of up to 25 words as a Back-Cover Text, to the end of the list of Cover Texts
6133 in the Modified Version. Only one passage of Front-Cover Text and one of Back-Cover
6252 .Bd -literal -offset indent
6258 with no Invariant Sections, no Front-Cover Texts, and no Back-Cover
6264 If you have Invariant Sections, Front-Cover Texts and Back-Cover Texts, replace
6267 .Bd -literal -offset indent
6270 the Front-Cover Texts being list, and with the Back-Cover Texts
6276 of the three, merge those two alternatives to suit the situation.