Re: Append newline to files



Martijn Lievaart <m@xxxxxxxxxxxxxxxx> wrote:
2) Or investigate if it are only the Windows files missing a trailing
lineseparator, it's a typical Windows problem.

And here you just fell into the trap.

If "\n" is a line _seperator_, then a trailing line separator would
simply indicate another emtpy line at the end of the file:
"foo\nbar\n"
would contains 3 lines, 'foo', 'bar' and an empty line.

If on the other hand "\n" is a line _terminator_ then the above string
would contain 2 lines. And
"foo\nbar\n\buzz"
would still be only two lines with some trailing junk.

jue
.