From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: Benjamin Riefenstahl Newsgroups: gmane.emacs.help Subject: Re: Reading portions of large files Date: 10 Jan 2003 21:35:30 +0100 Organization: None Sender: help-gnu-emacs-bounces+gnu-help-gnu-emacs=m.gmane.org@gnu.org Message-ID: References: NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: main.gmane.org 1042258078 21092 80.91.224.249 (11 Jan 2003 04:07:58 GMT) X-Complaints-To: usenet@main.gmane.org NNTP-Posting-Date: Sat, 11 Jan 2003 04:07:58 +0000 (UTC) Return-path: Original-Received: from monty-python.gnu.org ([199.232.76.173]) by main.gmane.org with esmtp (Exim 3.35 #1 (Debian)) id 18XCw8-0005U4-00 for ; Sat, 11 Jan 2003 05:07:56 +0100 Original-Received: from localhost ([127.0.0.1] helo=monty-python.gnu.org) by monty-python.gnu.org with esmtp (Exim 4.10.13) id 18XCta-00081E-0B for gnu-help-gnu-emacs@m.gmane.org; Fri, 10 Jan 2003 23:05:18 -0500 Original-Path: shelby.stanford.edu!newsfeed.stanford.edu!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!sn-xit-03!sn-xit-01!sn-post-02!sn-post-01!supernews.com!news.supernews.com!cicero.benny.turtle-trading.net!nobody Original-Newsgroups: gnu.emacs.help User-Agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.2 Original-X-Complaints-To: abuse@supernews.com Original-Lines: 27 Original-Xref: shelby.stanford.edu gnu.emacs.help:108826 Original-To: help-gnu-emacs@gnu.org X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1b5 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Help: List-Post: List-Subscribe: , List-Archive: List-Unsubscribe: , Errors-To: help-gnu-emacs-bounces+gnu-help-gnu-emacs=m.gmane.org@gnu.org Xref: main.gmane.org gmane.emacs.help:5354 X-Report-Spam: http://spam.gmane.org/gmane.emacs.help:5354 Brendan Halpin 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