Re: Append newline to files
- From: Martijn Lievaart <m@xxxxxxxxxxxxxxxx>
- Date: Wed, 30 Jul 2008 07:30:52 +0200
On Tue, 29 Jul 2008 20:14:01 +0000, Jürgen Exner wrote:
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.
You're right. But on Windows, it's a line separator[1]. On Unix, it's a
line terminator. So there is no correct way.
M4
[1] Although many programs follow Unix conventions, so it's ill advised
to rely on this.
.
- References:
- Append newline to files
- From: p19010101
- Re: Append newline to files
- From: Martijn Lievaart
- Re: Append newline to files
- From: Jürgen Exner
- Append newline to files
- Prev by Date: behavior of m// operator
- Next by Date: Re: behavior of m// operator
- Previous by thread: Re: Append newline to files
- Next by thread: FAQ 4.14 How can I compare two dates and find the difference?
- Index(es):