I have maybe a simple Problem - but I do not know to handle it.
All what I want, is to write a line to file without a newline at the end. It works with "echo -n" for all lines, but not for the last one. At the end of the file is always a "0a" (hex)
I am not a vim developer so i can only speculate: vim - like vi - is not a hex-editor, but a text-editor. As such it (tries to) create(s) "well-formed" text files. A text file in UNIX has to have a newline character at the end of each line - if there is only one line, like in your case, then it has to be at the end, before the EOF-character.
I suppose that od is showing the file as it is (well, this in fact i know) and vim is "correcting" the file format as it opens it. I bet that when you save this to a different file and analyse that with od it will show the "extra" newline character the same way as vim does.
@bakunin: Yes - this helps a lot. Thats means I have no Chance to see a file without a newline character in vim. With 'od' I will see the real world - as it is.
Because we're dealing with 2 different things here...one is the kernel view of the file which is an unformatted stream of bytes...and another is the application's view of the file. Some applications view the file as lines of text delimited by newlines, while others view it as fixed length records. The syntax of accessing the data in a file is defined by the kernel, which is an unformatted stream of bytes, and this syntax is identical for all programs, but the semantics or interpretation of the data varies from program to program...
On the other hand, a file without newlines containing printer escape sequences can be prefixed to a (plain text) print file without adding lines to the file and changing the page format.