About Us Documentation

Contact Site Map



Go to the previous, next chapter.

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 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 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 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 Line Formats. Finally, with the ed and forward ed output formats (see section 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

\ 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

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




Email addresses listed on this site may  NOT be used for unsolicited commercial email.

Ready-to-Run Software, Inc Privacy Statement

Portions (c)Copyright, 1996-2005 by Ready-to-Run Software, Inc
(All rights reserved.)
212 Cedar Cove
Lansing, NY 14882
Phone: 607 533 UNIX (8649)
Fax: 607 533 4002