Re: trailing blank line in a text file

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, 2004-07-20 at 22:30, Olga wrote:
> > On Tue, 2004-07-20 at 21:39, Olga wrote:
> >> 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).
> >>
> >
> > Let's try a different approach....
> >
> > After you save the file in whichever editor, can we confirm that it
> > actually has the "four lines" or really just has "three lines"?
> >
> > How about running "wc -l filename" and see how many lines it reports...
> > This will help to confirm for you whether the file truly has the blank
> > line, or is just a visual construct of the editor.
> >
> > --Rob
> >
> 
> wc -l returns 3 lines. But when I process the file in php (save each line
> in to an array and then produce a count), it reports 4 lines as does
> gedit.

Have you used a hex editor to really see what the file contains? 

od -ha filename

will dump the contents of the file in hex with the ascii.  

You can check the file before editing and after to really see what the
contents are.

-- 
Scot L. Harris
webid@xxxxxxxxxx

Questions are never indiscreet, answers sometimes are.
		-- Oscar Wilde 



[Index of Archives]     [Current Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Yosemite News]     [Yosemite Photos]     [KDE Users]     [Fedora Tools]     [Fedora Docs]

  Powered by Linux