trailing blank line in a text file

Olga olga at urbantimes.net
Wed Jul 21 01:39:09 UTC 2004


> On Tue, 20 Jul 2004, Alex White wrote:
>
>> > Can anybody tell me what is going on? Why do I get the trailing blank
>> line.
>> >
>> > Thank you.
>> >
>> > Olga
>>
>> What are you using to edit the files in question? I know that
>> in FC2 and I think FC1, emacs asks you when you edit a file if
>> you want a blank line inserted at the end. Could this be what
>            ^^^^^^^^^^^^^^^^^^^^^
>> you're seeing?
>
> Not a blank line, a linefeed at the end of the last line.  vi, on the
> other hand, always ends lines with a linefeed.  Some programs that read a
> line at a time will break if the last line does not end with a linefeed.
>
> --
> 		Matthew Saltzman

No in vi and nano I do not see anything. But in gedit I see the following
(for example)

1 Mike
2 John
3 Adam
4

The above is an example of what a file looks like with lines numbered.
(numbers are not actually part of the file). I want the file to be only 3
lines long (as an example); however, what I get is 4 lines where line 4 is
an empty line. I can eliminate only using mc (F4). In nano, vim, vi it is
invisible, but in gedit (gui editor) it shows what I displayed above. I
can backspace after 4, it bring me to Adam, but when I save the file and
reopen it, the output is exactly the same as I am showing now (empty line
4 stays).

What is the difference between a new lien \n and a line feed?







More information about the fedora-list mailing list