From owner-freebsd-questions@FreeBSD.ORG Fri Dec 18 10:11:51 2009 Return-Path: Delivered-To: freebsd-questions@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 9F27110656A5; Fri, 18 Dec 2009 10:11:51 +0000 (UTC) (envelope-from perryh@pluto.rain.com) Received: from agora.rdrop.com (unknown [IPv6:2607:f678:1010::34]) by mx1.freebsd.org (Postfix) with ESMTP id 717678FC13; Fri, 18 Dec 2009 10:11:51 +0000 (UTC) Received: from agora.rdrop.com (66@localhost [127.0.0.1]) by agora.rdrop.com (8.13.1/8.12.7) with ESMTP id nBIABg09039269 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NOT); Fri, 18 Dec 2009 02:11:42 -0800 (PST) (envelope-from perryh@pluto.rain.com) Received: (from uucp@localhost) by agora.rdrop.com (8.13.1/8.12.9/Submit) with UUCP id nBIABfGK039268; Fri, 18 Dec 2009 02:11:41 -0800 (PST) Received: from fbsd61 by pluto.rain.com (4.1/SMI-4.1-pluto-M2060407) id AA24581; Fri, 18 Dec 09 02:00:24 PST Date: Fri, 18 Dec 2009 01:59:36 -0800 From: perryh@pluto.rain.com To: wblock@wonkity.com, glarkin@freebsd.org Message-Id: <4b2b5288.qFxIl6ScdS9yKkZj%perryh@pluto.rain.com> References: <20091218005102.GA51064@mech-cluster241.men.bris.ac.uk> <4B2ADE9E.6080707@FreeBSD.org> In-Reply-To: <4B2ADE9E.6080707@FreeBSD.org> User-Agent: nail 11.25 7/29/05 Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Cc: mexas@bristol.ac.uk, freebsd-questions@freebsd.org Subject: Re: editing a binary file X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 18 Dec 2009 10:11:51 -0000 Greg Larkin wrote: > ... > > truncate -4 myfile should get rid of the last four bytes. Maybe > > there's a similar efficient way to truncate the start of a file. > > This should do it: > > dd if=oldfile of=newfile bs=1 skip=4 Or, perhaps marginally more efficient: dd if=oldfile of=newfile bs=4 skip=1