On Fri, 2 Nov 2007, Horinius wrote: > > > > Hugh Sasse wrote: > > > > On Fri, 2 Nov 2007, Horinius wrote: > >> I've found that if the last line isn't terminated by a new-line, that > >> line > >> can't be read. This seems to be a very common error and I've seen it in > >> other commands. > > > > This is a Unix convention. I don't know the origins. > > > > I was not talking about new-line vs carriage-return vs new-line AND > carriage-return.
I wasn't either. > > I was saying that if the last character of the last line is also the last > character of the file, that line isn't read. Or is it really what you're > referring to as "Unix convention"? Yes, for example: brains hgs 71 %> mkdir tmp brains hgs 72 %> cd tmp brains hgs 73 %> echo -n "file with one line" > somefile brains hgs 74 %> od -x somefile 0000000 6669 6c65 2077 6974 6820 6f6e 6520 6c69 0000020 6e65 0000022 brains hgs 75 %> cat !$ cat somefile file with one linebrains hgs 76 %> wc !$ wc somefile 0 4 18 somefile brains hgs 77 %> ed !$ ed somefile '\n' appended 19 q brains hgs 78 %> And vi warns about it in a similar way to ed. Again, what problem are you trying to solve, if any? Hugh