[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

3. Incomplete Lines

When an input file ends in a non-newline character, its last line is called an incomplete line because its last character is not a newline. All other lines are called full lines and end in a newline character. Incomplete lines do not match full lines unless differences in white space are ignored (see section 1.2 Suppressing Differences in Blank and Tab Spacing).

An incomplete line is normally distinguished on output from a full line by a following line that starts with `\'. However, the RCS format (see section 2.5.3 RCS Scripts) outputs the incomplete line as-is, without any trailing newline or following line. The side by side format normally represents incomplete lines as-is, but in some cases uses a `\' or `/' gutter marker; See section 2.4 Showing Differences Side by Side. The if-then-else line format preserves a line's incompleteness with `%L', and discards the newline with `%l'; See section 2.6.2 Line Formats. Finally, with the ed and forward ed output formats (see section 2. diff Output Formats) diff cannot represent an incomplete line, so it pretends there was a newline and reports an error.

For example, suppose `F' and `G' are one-byte files that contain just `f' and `g', respectively. Then `diff F G' outputs

 
1c1
< f
\ No newline at end of file
---
> g
\ No newline at end of file

(The exact message may differ in non-English locales.) `diff -n F G' outputs the following without a trailing newline:

 
d1 1
a1 1
g

`diff -e F G' reports two errors and outputs the following:

 
1c
g
.



This document was generated on April 4, 2002 using texi2html