diffutils: Incomplete Lines
1
1 3 Incomplete Lines
1 ******************
1
1 When an input file ends in a non-newline character, its last line is
1 called an "incomplete line" because its last character is not a newline.
1 All other lines are called "full lines" and end in a newline character.
1 Incomplete lines do not match full lines unless differences in white
1 space are ignored (⇒White Space).
1
1 An incomplete line is normally distinguished on output from a full
1 line by a following line that starts with '\'. However, the RCS format
1 (⇒RCS) outputs the incomplete line as-is, without any trailing
1 newline or following line. The side by side format normally represents
1 incomplete lines as-is, but in some cases uses a '\' or '/' gutter
1 marker. ⇒Side by Side. The if-then-else line format preserves a
1 line's incompleteness with '%L', and discards the newline with '%l'.
1 ⇒Line Formats. Finally, with the 'ed' and forward 'ed' output
1 formats (⇒Output Formats) 'diff' cannot represent an incomplete
1 line, so it pretends there was a newline and reports an error.
1
1 For example, suppose 'F' and 'G' are one-byte files that contain just
1 'f' and 'g', respectively. Then 'diff F G' outputs
1
1 1c1
1 < f
1 \ No newline at end of file
1 ---
1 > g
1 \ No newline at end of file
1
1 (The exact message may differ in non-English locales.) 'diff -n F G'
1 outputs the following without a trailing newline:
1
1 d1 1
1 a1 1
1 g
1
1 'diff -e F G' reports two errors and outputs the following:
1
1 1c
1 g
1 .
1