From owner-freebsd-questions@FreeBSD.ORG Mon Dec 8 20:44:44 2003 Return-Path: Delivered-To: freebsd-questions@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 0357A16A4CE for ; Mon, 8 Dec 2003 20:44:44 -0800 (PST) Received: from gabby.gsicomp.on.ca (CPE00062566c7bb-CM000039c69a66.cpe.net.cable.rogers.com [24.192.222.167]) by mx1.FreeBSD.org (Postfix) with ESMTP id 964EB43D1F for ; Mon, 8 Dec 2003 20:44:42 -0800 (PST) (envelope-from matt@gsicomp.on.ca) Received: from hermes (hermes.gsicomp.on.ca [192.168.0.18]) by gabby.gsicomp.on.ca (8.12.9p2/8.12.9) with SMTP id hB94Xq1Z067727; Mon, 8 Dec 2003 23:33:53 -0500 (EST) (envelope-from matt@gsicomp.on.ca) Message-ID: <000e01c3be0e$b8774670$1200a8c0@gsicomp.on.ca> From: "Matt Emmerton" To: "Dan Nelson" , "Kevin D. Kinsey, DaleCo, S.P." References: <20031209015125.74977.qmail@web14806.mail.yahoo.com><200312090259.23677@harrymail> <3FD54A37.8050503@daleco.biz> <20031209043046.GC2435@dan.emsphone.com> Date: Mon, 8 Dec 2003 23:41:32 -0500 MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit X-Priority: 3 X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook Express 6.00.2800.1158 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165 cc: homeyra g cc: freebsd-questions@freebsd.org cc: Harald Schmalzbauer Subject: Re: a technical how to X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 09 Dec 2003 04:44:44 -0000 > In the last episode (Dec 08), Kevin D. Kinsey, DaleCo, S.P. said: > > Harald Schmalzbauer wrote: > > >On Tuesday 09 December 2003 02:51, homeyra g wrote: > > >>So, I hope this is the right address for this type of question. If > > >>not would you please forward this and/or let me know the correct > > >>address. > > >> > > >>Thanks, > > >> > > >>Here is the question: How to truncate a file from the begining to a > > >>certain point in the file? > > If you're writing a script, use the /usr/bin/truncate command. If > you're writing a C program, use the truncate() function. truncate() essentially alters the "end-of-file" position, by decreasing it (truncating the file) or increasing it (extending the file.) I think what the requestor wants is a way to adjust the "start-of-file" position, which would effectively "truncate [sic] a file from the beginning to a certain point in the file". One way to accomplish this is as follows: split -b 1024 /path/to/data rm cat * > data.new -- Matt Emmerton