Lines Matching full:lines
77 * Incomplete Lines:: Lines that lack trailing newlines.
190 One way to think of the differences is as a series of lines that were
193 lines that differ, and reports each group of differing lines. It can
194 report the differing lines in several formats, which have different
201 between words or lines. @command{diff} also provides ways to suppress
202 differences in alphabetic case or in lines that match a regular
224 groups of lines that differ, and reports each group of differing lines.
229 * Hunks:: Groups of differing lines.
231 * Blank Lines:: Suppressing differences whose lines are all blank.
232 * Specified Lines:: Suppressing differences whose lines all match a pattern.
242 When comparing two files, @command{diff} finds sequences of lines common to
243 both files, interspersed with groups of differing lines called
245 common lines and no hunks, because no lines differ. Comparing two
246 entirely different files yields no common lines and one large hunk that
247 contains all lines of both files. In general, there are many ways to
248 match up lines between two given files. @command{diff} tries to minimize
249 the total hunk size by finding large sequences of common lines
250 interspersed with small hunks of differing lines.
252 For example, suppose the file @file{F} contains the three lines
254 three lines in reverse order @samp{c}, @samp{b}, @samp{a}. If
301 option, @command{diff} considers the following two lines to be equivalent,
315 following two lines to be equivalent, where @samp{$} denotes the line
323 @node Blank Lines
324 @section Suppressing Differences Whose Lines Are All Blank
327 The @option{-B} or @option{--ignore-blank-lines} option ignores changes
328 that consist entirely of blank lines. With this option, for example, a
346 Normally this option affects only lines that are completely empty, but
349 lines are also affected if they look empty but contain white space.
354 @node Specified Lines
355 @section Suppressing Differences Whose Lines All Match a Regular Expression
358 To ignore insertions and deletions of lines that match a
360 @var{regexp}} or @option{--ignore-matching-lines=@var{regexp}} option.
364 all changes to lines beginning with a digit.
366 However, @option{-I} only ignores the insertion or deletion of lines that
372 You can specify more than one regular expression for lines to ignore by
443 showing differences between long lines of whatever characters the files
473 lines that end in carriage return followed by newline as if they end
476 This option affects how lines are read, which in turn affects how they
556 In this example, the first hunk contains just the first two lines of
558 opposing the second and third lines of @file{tzu}, and the last hunk
559 contains just the last three lines of @file{tzu}.
567 also want to see the parts of the files near the lines that differ, to
572 around the differing lines: @dfn{context format} and @dfn{unified
574 file the differing lines are found.
580 the diffs in this case by searching in the files for the lines of
581 context around the differing lines; if those lines are actually a few
582 lines away from where the diff says they are, @command{patch} can adjust
588 * Context Format:: An output format that shows surrounding lines.
597 The context output format shows several lines of context around the
598 lines that differ. It is the standard format for distributing updates
601 To select this output format, use the @option{-C @var{lines}},
602 @option{--context@r{[}=@var{lines}@r{]}}, or @option{-c} option. The
603 argument @var{lines} that some of these options take is the number of
604 lines of context to show. If you do not specify @var{lines}, it
606 at least two lines of context.
619 lines that are not different are shown around each line that is
620 different; they are the context lines. Also notice that the first two
722 If a hunk contains two or more lines, its line numbers look like
727 The lines of context around the lines that differ start with two space
728 characters. The lines that differ between the two files start with one
733 A line that is part of a group of one or more lines that changed between
734 the two files. There is a corresponding group of lines marked with
746 If all of the changes in a hunk are insertions, the lines of
748 lines of @var{to-file} are omitted.
756 more compact because it omits redundant context lines. To select this
757 output format, use the @option{-U @var{lines}},
758 @option{--unified@r{[}=@var{lines}@r{]}}, or @option{-u}
759 option. The argument @var{lines} is the number of lines of context to
765 least three lines of context.
834 If a hunk and its context contain two or more lines, its
839 The lines common to both files begin with a space character. The lines
861 the differing lines. Which lines are ``section headings'' is
870 @subsubsection Showing Lines That Match Regular Expressions
877 considers lines that match the @command{grep}-style regular expression
904 regular expression for such lines; @command{diff} tries to match each line
916 (@pxref{Context Format}), with the default number of lines of context.
917 You can override that number with @option{-C @var{lines}} elsewhere in the
919 @option{-U @var{lines}} elsewhere in the command line.
942 Here are the first two lines of the output from @samp{diff -C 2
962 The corresponding lines are in common. That is, either the lines are
967 The corresponding lines differ, and they are either both complete
983 The corresponding lines differ, and only the first line is incomplete.
986 The corresponding lines differ, and only the second line is incomplete.
989 Normally, an output line is incomplete if and only if the lines that it
990 contains are incomplete; @xref{Incomplete Lines}. However, when an
991 output line represents two differing lines, one might be incomplete
997 It generates much wider output than usual, and truncates lines that are
1015 format. Because side by side output lines contain two input lines, the
1021 stop so that tabs line up. Input lines that are too long to fit in half
1025 common lines. The @option{--suppress-common-lines} option suppresses
1026 common lines entirely.
1059 way to see how lines have changed, without the clutter of nearby
1060 unchanged lines (although you can get similar results with the context
1061 or unified formats by using 0 lines of context). However, this format
1079 Notice that it shows only the lines that are different between the two
1114 number or comma-separated range of lines in the first file, a single
1116 comma-separated range of lines in the second file. All line numbers are
1122 Add the lines in range @var{r} of the second file after line @var{l} of
1123 the first file. For example, @samp{8a12,15} means append lines 12--15
1125 delete lines 12--15 of file 2.
1128 Replace the lines in range @var{f} of the first file with lines in range
1130 more compact. For example, @samp{5,7c8,10} means change lines 5--7 of
1131 file 1 to read as lines 8--10 of file 2; or, if changing file 2 into
1132 file 1, change lines 8--10 of file 2 to read as lines 5--7 of file 1.
1135 Delete the lines in range @var{r} from the first file; line @var{l} is where
1137 For example, @samp{5,7d3} means delete lines 5--7 of file 1; or, if
1138 changing file 2 into file 1, append lines 5--7 of file 1 after line 3 of
1207 that commands that change the number of lines do not affect how
1219 end of input, @acronym{GNU} @command{diff} protects lines of changes
1228 number or comma-separated range of lines in the first file and a single
1236 example, @samp{8a} means to add the following lines after line 8 of file
1240 Replace the lines in range @var{r} in the first file with the following
1241 lines. Like a combined add and delete, but more compact. For example,
1242 @samp{5,7c} means change lines 5--7 of file 1 to read as the text file
1246 Delete the lines in range @var{r} from the first file. For example,
1247 @samp{5,7d} means delete lines 5--7 of file 1.
1256 is also changed slightly: command characters precede the lines they
1258 to disambiguate hunk lines consisting of a single period. Like
1260 lines.
1277 avoids the forward @command{ed} format's problems with lines
1278 consisting of a single period and with incomplete lines. Instead of
1280 command specifies the number of lines it affects; a combination of the
1308 of @command{diff} in this format contains all the lines of both files.
1309 Lines common to both files are output just once; the differing parts are
1354 the output format for a contiguous group of similar lines.
1358 surrounded by @samp{\begin@{em@}}-@samp{\end@{em@}} lines, and new
1359 regions are surrounded by @samp{\begin@{bf@}}-@samp{\end@{bf@}} lines.
1415 These line groups are hunks containing only lines from the first file.
1420 These line groups are hunks containing only lines from the second
1426 These line groups are hunks containing lines from both files. The
1431 These line groups contain lines common to both files. The default
1441 stands for the lines from the first file, including the trailing newline.
1445 stands for the lines from the second file, including the trailing newline.
1449 stands for the lines common to both files, including the trailing newline.
1487 The number of lines in the group in the old file; equals @var{l} - @var{f} + 1.
1490 Likewise, for lines in the new file.
1505 For example, @samp{%5dN} prints the number of new lines in the group
1516 @samp{no lines} if @var{N} (the number of lines in the group in the
1517 new file) is 0, to @samp{1 line} if @var{N} is 1, and to @samp{%dN lines}
1530 is @samp{-} for deleted lines, @samp{|} for added lines, and a space for
1531 unchanged lines. The formats contain newline characters where newlines
1550 formats lines just from the first file.
1553 formats lines just from the second file.
1556 formats lines common to both files.
1559 formats all lines; in effect, it sets all three above options simultaneously.
1570 @xref{Incomplete Lines}.
1664 For lines common to both files, @command{diff} uses the unchanged line
1666 format, if the hunk contains only lines from the first file,
1668 lines from the second file, @command{diff} uses the new group format;
1672 lines from the first file, lines from the second file, and lines common
1695 differing lines contain any of the C preprocessor directives
1707 @node Incomplete Lines
1708 @chapter Incomplete Lines
1709 @cindex incomplete lines
1710 @cindex full lines
1715 newline. All other lines are called @dfn{full lines} and end in a
1716 newline character. Incomplete lines do not match full lines unless
1723 format normally represents incomplete lines as-is, but in some cases
1817 white space and empty lines are ignored in the pattern file.
1859 The lines of text in some of the @command{diff} output formats are
1880 disadvantage is that it can make long lines too long to fit on one line
1925 The way that @acronym{GNU} @command{diff} determines which lines have
1945 non-minimal output. The @option{--horizon-lines=@var{lines}} option
1946 prevents @command{diff} from discarding the last @var{lines} lines of the
1947 prefix and the first @var{lines} lines of the suffix. This gives
1950 Suppose a run of changed lines includes a sequence of lines at one end
1951 and there is an identical sequence of lines just outside the other end.
1955 lines towards the end of the file. Merging hunks can make the output
1969 on whether they are two-way or three-way, and lines are annotated by
2013 Notice that it shows only the lines that are different among the three
2051 plain @samp{====} lines, and two-way hunks have @samp{1}, @samp{2}, or
2054 lines each preceded by one or two commands identifying where the lines
2059 option, @command{diff3} uses a tab instead of two spaces; this lines up
2067 contains no lines in that file. To edit this file to yield the other
2068 files, one must append hunk lines taken from the other files. For
2070 file and contains no lines from that file.
2073 This hunk contains the lines in the range @var{r} of file @var{file}.
2076 other files, one must change the specified lines to be the lines taken
2078 contains lines 11 through 13 from the second file.
2081 If the last line in a set of input lines is incomplete
2082 (@pxref{Incomplete Lines}), it is distinguished on output from a full
2090 Groups of lines that differ in two or three of the input files are
2102 For example, suppose @file{F} contains the three lines @samp{a},
2103 @samp{b}, @samp{f}, @file{G} contains the lines @samp{g}, @samp{b},
2104 @samp{g}, and @file{H} contains the lines @samp{a}, @samp{b},
2169 or mark conflicts with special @samp{<<<<<<<} and @samp{>>>>>>>} lines.
2180 * Merging Incomplete Lines:: How @command{diff3} merges incomplete lines.
2240 bracketing them with special marker lines. A conflict
2245 @r{lines from @var{A}}
2247 @r{lines from @var{B}}
2256 @r{lines from @var{A}}
2258 @r{lines from @var{B}}
2260 @r{lines from @var{C}}
2361 @node Merging Incomplete Lines
2362 @section How @command{diff3} Merges Incomplete Lines
2365 With @option{-m}, incomplete lines (@pxref{Incomplete Lines}) are simply
2424 --ignore-blank-lines --ignore-case
2425 --ignore-matching-lines=@var{regexp} --ignore-space-change
2428 --strip-trailing-cr --suppress-common-lines
2435 to @option{--suppress-common-lines}. The meaning of the @command{sdiff}
2448 Groups of common lines, with a blank gutter, are copied from the first
2449 file to the output. After each group of differing lines, @command{sdiff}
2465 shows what file and lines the version came from.
2487 Silently copy common lines.
2490 Verbosely copy common lines. This is the default.
2615 encapsulated by prepending @w{@samp{- }} to lines beginning with @samp{-}
2661 anywhere. But most patches add or change lines rather than delete them,
2683 set of lines matching the context given in the hunk.
2685 First @command{patch} looks for a place where all lines of the context
2690 more, it makes another scan, ignoring the first two and last two lines
2694 The @option{-F @var{lines}} or @option{--fuzz=@var{lines}} option sets the
2695 maximum fuzz factor to @var{lines}. This option only applies to context
2696 and unified diffs; it ignores up to @var{lines} lines while looking for
2699 is no point to setting it to more than the number of lines of context
2725 lines of context shown in the diff (typically 3). In these cases, you
3344 @acronym{GNU} @command{diff} can analyze files with arbitrarily long lines
3345 and files that end in incomplete lines. However, older versions of
3438 You can also shrink the patch size by using fewer lines of context,
3440 lines for proper operation when patches do not exactly match the input
3451 lines are numbered starting with 1. The arguments of @command{cmp}
3697 @itemx --ignore-blank-lines
3698 Ignore changes that just insert or delete blank lines. @xref{Blank
3699 Lines}.
3705 Use the context output format, showing three lines of context.
3708 @item -C @var{lines}
3709 @itemx --context@r{[}=@var{lines}@r{]}
3710 Use the context output format, showing @var{lines} (an integer) lines of
3711 context, or three if @var{lines} is not given. @xref{Context Format}.
3712 For proper operation, @command{patch} typically needs at least two lines of
3716 @option{-@var{lines}} that has effect when combined with @option{-c}
3718 conformance}) does not allow this; use @option{-C @var{lines}}
3722 Use @var{format} to output a line group containing differing lines from
3761 @item --horizon-lines=@var{lines}
3762 Do not discard the last @var{lines} lines of the common prefix
3763 and the first @var{lines} lines of the common suffix.
3772 @itemx --ignore-matching-lines=@var{regexp}
3773 Ignore changes that just insert or delete lines that match @var{regexp}.
3774 @xref{Specified Lines}.
3790 Print only the left column of two common lines in side by side format.
3794 Use @var{format} to output all input lines in if-then-else format.
3800 specifies the number of lines affected. @xref{RCS}.
3809 Use @var{format} to output a group of lines taken from just the second
3817 Use @var{format} to output a group of lines taken from just the first
3855 @item --suppress-common-lines
3856 Do not print common lines in side by side format.
3878 Use the unified output format, showing three lines of context.
3882 Use @var{format} to output a group of common lines taken from both files
3894 @item -U @var{lines}
3895 @itemx --unified@r{[}=@var{lines}@r{]}
3896 Use the unified output format, showing @var{lines} (an integer) lines of
3897 context, or three if @var{lines} is not given. @xref{Unified Format}.
3898 For proper operation, @command{patch} typically needs at least two lines of
3902 @option{-@var{lines}} that has effect when combined with @option{-u}.
3904 this; use @option{-U @var{lines}} instead.
3912 Ignore white space when comparing lines. @xref{White Space}.
3975 @var{mine}, surrounding conflicts with bracket lines.
3989 Like @option{-e}, except bracket lines from overlapping changes' first
3996 @r{lines from @var{mine}}
3998 @r{lines from @var{yours}}
4025 works even for binary files and incomplete lines. @option{-A} is assumed
4163 @item -F @var{lines}
4164 @itemx --fuzz=@var{lines}
4165 Set the maximum fuzz factor to @var{lines}. @xref{Inexact}.
4335 @itemx --ignore-blank-lines
4336 Ignore changes that just insert or delete blank lines. @xref{Blank
4337 Lines}.
4363 @itemx --ignore-matching-lines=@var{regexp}
4364 Ignore changes that just insert or delete lines that match @var{regexp}.
4365 @xref{Specified Lines}.
4369 Print only the left column of two common lines.
4377 @itemx --suppress-common-lines
4378 Do not print common lines. @xref{Side by Side Format}.
4409 Ignore white space when comparing lines. @xref{White Space}.
4589 two lines differ only in that @samp{foo} in file 1 corresponds to
4590 @samp{bar} in file 2, the lines are treated as identical.