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

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

Re: Reading portions of large files


From: Brendan Halpin
Subject: Re: Reading portions of large files
Date: 10 Jan 2003 17:16:18 +0000
User-agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.1

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>


reply via email to

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