trailing blank line in a text file
Nifty Hat Mitch
mitch48 at sbcglobal.net
Thu Jul 22 19:43:46 UTC 2004
On Tue, Jul 20, 2004 at 06:31:39PM -0500, Olga 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 have not tried emacs. I originally edited the files with nano. But later
> in order to get rid of that trailing blank line I used vim, nano, gedit
> and mc. ....
Can you show us the last bits of the file (od -x).
I suspect you are seeing a NL .vs. CR+LF thing.
There may also be a difference in the trailing newline. Code that
expects a line to end (readline) expect the NL character.
Here are ways to look at it.
$ echo -n bark > /tmp/bark
$ echo gark > /tmp/gark
$ wc /tmp/bark /tmp/gark
0 1 4 /tmp/bark
1 1 5 /tmp/gark
$ od -x /tmp/bark
0000000 6162 6b72
0000004
$ od -x /tmp/gark
0000000 6167 6b72 000a
0000005
[mitch at xtl1 one]$
$ unix2dos /tmp/bark
unix2dos: converting file /tmp/bark to DOS format ...
$ unix2dos /tmp/gark
unix2dos: converting file /tmp/gark to DOS format ...
$ od -x /tmp/gark
0000000 6167 6b72 0a0d
0000006
$ od -x /tmp/bark
0000000 6162 6b72
0000004
$ echo -n bark > /tmp/bar
$ wc /tmp/bar
0 1 4 /tmp/bar
$ vi /tmp/bar
$ wc /tmp/bar
1 1 5 /tmp/bar
See vim's documentation on :filetype
and "set notextmode"...
But first lets see what the specific problem is.
--
T o m M i t c h e l l
/dev/dull where insight begins.
More information about the fedora-list
mailing list