help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

The last character of a file


From: Matthew Walker
Subject: The last character of a file
Date: Fri, 07 Nov 2003 12:34:51 +1300
User-agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.5) Gecko/20031007

Emacs is adding a newline to the end of my file.  I'd like it not to :o)

I have a large file (~200Mb) that I wish to edit. Emacs tells me that it's too large to open. I only want to alter a few bytes in the first 1000, so I extract them using head:

head --bytes=1000 source.file > source.file.head

I then extract the end of the file:

tail --bytes=<filesize-1000> source.file > source.file.tail

Next on the list is to edit source.file.head, and then put the two files back together:

cat source.file.head source.file.tail > source.file.updated

My problem is that emacs seems not to like the fact that source.file.head doesn't end with a newline. It seems to feel compelled to add a newline to the end of the file. The file is now 1001 bytes in size, and they just don't append nicely like that.

I could cut off the last byte by

head --bytes=1000 source.file.head | cat - source.file.tail > source.file.updated

But I'd like more to know either:
* how to edit the file with emacs, or
* how to stop emacs from adding the newline.

Thank you for your thoughts,

Matthew.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]