From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: Brendan Halpin Newsgroups: gmane.emacs.help Subject: Re: Reading portions of large files Date: 10 Jan 2003 17:16:18 +0000 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 1042218987 4337 80.91.224.249 (10 Jan 2003 17:16:27 GMT) X-Complaints-To: usenet@main.gmane.org NNTP-Posting-Date: Fri, 10 Jan 2003 17:16:27 +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 18X2le-00017o-00 for ; Fri, 10 Jan 2003 18:16:26 +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 18X2kq-0006JV-00 for gnu-help-gnu-emacs@m.gmane.org; Fri, 10 Jan 2003 12:15:36 -0500 Original-Path: shelby.stanford.edu!newsfeed.stanford.edu!canoe.uoregon.edu!logbridge.uoregon.edu!fu-berlin.de!uni-berlin.de!wivenhoe.staff8.ul.IE!not-for-mail Original-Newsgroups: gnu.emacs.help Original-Lines: 27 Original-NNTP-Posting-Host: wivenhoe.staff8.ul.ie (136.201.147.134) Original-X-Trace: fu-berlin.de 1042218668 18277868 136.201.147.134 (16 [139789]) User-Agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.1 Original-Xref: shelby.stanford.edu gnu.emacs.help:108802 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:5331 X-Report-Spam: http://spam.gmane.org/gmane.emacs.help:5331 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