From owner-freebsd-questions@FreeBSD.ORG Fri Dec 18 01:38:11 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 C079F10656D1 for ; Fri, 18 Dec 2009 01:38:11 +0000 (UTC) (envelope-from wblock@wonkity.com) Received: from wonkity.com (wonkity.com [67.158.26.137]) by mx1.freebsd.org (Postfix) with ESMTP id 7781E8FC13 for ; Fri, 18 Dec 2009 01:38:11 +0000 (UTC) Received: from wonkity.com (localhost [127.0.0.1]) by wonkity.com (8.14.3/8.14.3) with ESMTP id nBI1c4As053948; Thu, 17 Dec 2009 18:38:04 -0700 (MST) (envelope-from wblock@wonkity.com) Received: from localhost (wblock@localhost) by wonkity.com (8.14.3/8.14.3/Submit) with ESMTP id nBI1c4NX053945; Thu, 17 Dec 2009 18:38:04 -0700 (MST) (envelope-from wblock@wonkity.com) Date: Thu, 17 Dec 2009 18:38:04 -0700 (MST) From: Warren Block To: Anton Shterenlikht In-Reply-To: <20091218005102.GA51064@mech-cluster241.men.bris.ac.uk> Message-ID: References: <20091218005102.GA51064@mech-cluster241.men.bris.ac.uk> User-Agent: Alpine 2.00 (BSF 1167 2008-08-23) MIME-Version: 1.0 Content-Type: TEXT/PLAIN; format=flowed; charset=US-ASCII X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.2.3 (wonkity.com [127.0.0.1]); Thu, 17 Dec 2009 18:38:04 -0700 (MST) Cc: 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 01:38:11 -0000 On Fri, 18 Dec 2009, Anton Shterenlikht wrote: > I'm creating binary files in fortran. > Fortran adds 4 byte record delimiters at the beginning > and the end of each record, which, in the case of a binary > file, is just at the beginning and at the end of the file. > I need to delete these record delimiters, because the > software I use to visualise the binary files interprets > them as data. But I don't know how. I've looked at > hexdump and od, but those are only dumping (I think) > file contents, and I cannot see how to edit a file with them. 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. -Warren Block * Rapid City, South Dakota USA