2

Why do some text editors such as BBEdit and Textmate offer to end your file with a newline (line break)? Why is that important?

Are there any caveats to not ending a file with a line break?

Gareth
  • 19,080
racl101
  • 206

1 Answers1

4

Some Unix-style text processing commands may produce unexpected behavior if the last line does not end with a newline. For example, wc -l counts the number of lines in a file, but it does so essentially by counting the newline characters, so the last "line" isn't counted. Some other programs also miss the last line if it's not terminated by a newline.

juggler
  • 1,568
  • 8
  • 15