From owner-freebsd-questions@FreeBSD.ORG Sun Feb 1 23:14:18 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 60FA4106567A for ; Sun, 1 Feb 2009 23:14:18 +0000 (UTC) (envelope-from perryh@pluto.rain.com) Received: from agora.rdrop.com (agora.rdrop.com [199.26.172.34]) by mx1.freebsd.org (Postfix) with ESMTP id 3BF348FC26 for ; Sun, 1 Feb 2009 23:14:18 +0000 (UTC) (envelope-from perryh@pluto.rain.com) Received: from agora.rdrop.com (66@localhost [127.0.0.1]) by agora.rdrop.com (8.13.1/8.12.7) with ESMTP id n11NE05J023937 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NOT); Sun, 1 Feb 2009 15:14:01 -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 n11NE0Sn023936; Sun, 1 Feb 2009 15:14:00 -0800 (PST) Received: from fbsd61 by pluto.rain.com (4.1/SMI-4.1-pluto-M2060407) id AA05678; Sun, 1 Feb 09 15:03:25 PST Date: Sun, 01 Feb 2009 15:04:51 -0800 From: perryh@pluto.rain.com To: m.seaman@infracaninophile.co.uk, freebsd@edvax.de Message-Id: <49862a93.mPk92H+6FBE9Dl8m%perryh@pluto.rain.com> References: <20090201140102.e9a9a41a.freebsd@edvax.de> <4985EE02.5030001@infracaninophile.co.uk> In-Reply-To: <4985EE02.5030001@infracaninophile.co.uk> User-Agent: nail 11.25 7/29/05 Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Cc: freebsd-questions@freebsd.org Subject: Re: Tool to uncat 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: Sun, 01 Feb 2009 23:14:18 -0000 > > before starting to code on my own, I'd like to ask if there's > > already a tool to uncat files, defining the file separation > > position as a string of bytes, usually given in hexadecimal form. > > > > An example could be this: > > > > % uncat -p 0x12,0x52,0xf1,0x09 file_orig > > > > It creates file_1 file_2 file_3. And, of course, > > > > % cat file_1 file_2 file_3 > file_orig > > > > would re-create the original file. The bytes 0x12,0x52,0xf1,0x09 > > tell the file starting pattern (-p), where a new file begins. > > > > I cannot use dd due to the fact that the files concatenated are > > of a different size ... > > csplit(1) csplit would cover the case where the input file is text, to be split on line boundaries based on patterns found within the lines; but the example given looks like a binary pattern and my reading of the inquiry is that the split should occur at the pattern rather than at a nearby newline. Grepping the ports INDEX for "split" yields the following candidates which might bear examination, to see if any of them will work: misc/granulate sysutils/gfslicer sysutils/hoz sysutils/lxsplit