unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
From: Matthew Walker <m.g.walker@NOmassey.SPac.AMnz>
Subject: The last character of a file
Date: Fri, 07 Nov 2003 12:34:51 +1300	[thread overview]
Message-ID: <boelgt$45o$1@lust.ihug.co.nz> (raw)

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	other threads:[~2003-11-06 23:34 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-11-06 23:34 Matthew Walker [this message]
2003-11-06 23:41 ` The last character of a file Dan Anderson
2003-11-07 17:44 ` Stefan Monnier
2003-11-08  0:48 ` Thien-Thi Nguyen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='boelgt$45o$1@lust.ihug.co.nz' \
    --to=m.g.walker@nomassey.spac.amnz \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).