[Top][All Lists]

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

Re: Reading portions of large files

From: Benjamin Riefenstahl
Subject: Re: Reading portions of large files
Date: 10 Jan 2003 21:35:30 +0100
User-agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.2

Brendan Halpin <address@hidden> writes:
> 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

This assumes a) Unix, b) that you have the space and time ;-) to deal
with the large temporary files.

If you can assume Unix, dd is a little better, I think.  I recently
had success with using it for extracting and later re-inserting a bit
in a large file.  Getting the options right is a bit of a pain, but
the main thing was getting the direction (extract and re-insert) right
and using conv=notrunc for re-insertion.  And than dd is oriented
towards blocks of bytes, not lines, of course.  And you can not change
the size of the block to be edited, but than large files are usually
binary files, where you don't want to change byte offsets anyway. 

so long, benny

reply via email to

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