unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
From: Brendan Halpin <brendan.halpin@ul.ie>
Subject: Re: Reading portions of large files
Date: 10 Jan 2003 17:16:18 +0000	[thread overview]
Message-ID: <m34r8h7wnx.fsf@wivenhoe.staff8.ul.ie> (raw)
In-Reply-To: mailman.100.1042135372.21513.help-gnu-emacs@gnu.org

Gerald.Jean@spgdag.ca writes:

> I have very large files, sometimes over 1G, from which I would like to edit
> very small portions, the headers or trailers for example.  Emacs won't open
> those files, it complains about them being too big.  Is it possible to
> edit, and save back after editing, only small portions of such files.

Use head and tail to split the file into the header-to-be-edited
and the-rest. Edit the header-to-be-edited in emacs, save, then
concatenated the-rest onto it.

Assuming all editing is within the first 2000 bytes (not tested):

head -c2000 bigfile > header-to-be-edited
tail -c+2001 bigfile > the-rest
(edit header-to-be-edited, save)
cat header-to-be-edited the-rest > new-big-file

Even if the file is not too big to fit in Emacs, this should be
faster for very big files where the editing is all in a small
section. 

Brendan
-- 
Brendan Halpin,  Deptartment of Sociology,  University of Limerick,  Ireland
Tel: w +353-61-213147 f +353-61-202569 h +353-61-390476;  Room F2-025 x 3147
<mailto:brendan.halpin@ul.ie>        <http://wivenhoe.staff8.ul.ie/~brendan>

  parent reply	other threads:[~2003-01-10 17:16 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <mailman.100.1042135372.21513.help-gnu-emacs@gnu.org>
2003-01-09 18:20 ` Reading portions of large files David Kastrup
2003-01-10 19:21   ` Eli Zaretskii
     [not found]   ` <mailman.153.1042230313.21513.help-gnu-emacs@gnu.org>
2003-01-10 20:51     ` David Kastrup
2003-01-11  8:51       ` Eli Zaretskii
     [not found]       ` <mailman.169.1042278925.21513.help-gnu-emacs@gnu.org>
2003-01-11 10:42         ` David Kastrup
2003-01-12 20:38       ` Stefan Monnier <foo@acm.com>
2003-01-13  7:40         ` Miles Bader
2003-01-13  7:42           ` Miles Bader
2003-01-13  7:55             ` David Kastrup
2003-01-13  8:05               ` Miles Bader
2003-01-20  7:50         ` Lee Sau Dan
2003-01-24  7:55           ` Mac
2003-01-27 14:44           ` Stefan Monnier <foo@acm.com>
2003-01-10 16:27 ` Eric Pement
2003-01-10 17:16 ` Brendan Halpin [this message]
2003-01-10 20:35   ` Benjamin Riefenstahl
2003-01-11 10:25     ` Klaus Berndl
2003-01-20  7:50     ` Lee Sau Dan
2003-01-20 12:46       ` Benjamin Riefenstahl
2003-01-20  7:50   ` Lee Sau Dan
2003-01-09 15:45 Gerald.Jean

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=m34r8h7wnx.fsf@wivenhoe.staff8.ul.ie \
    --to=brendan.halpin@ul.ie \
    /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).