Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 01 Feb 2009 15:04:51 -0800
From:      perryh@pluto.rain.com
To:        m.seaman@infracaninophile.co.uk, freebsd@edvax.de
Cc:        freebsd-questions@freebsd.org
Subject:   Re: Tool to uncat file
Message-ID:  <49862a93.mPk92H%2B6FBE9Dl8m%perryh@pluto.rain.com>
In-Reply-To: <4985EE02.5030001@infracaninophile.co.uk>
References:  <20090201140102.e9a9a41a.freebsd@edvax.de> <4985EE02.5030001@infracaninophile.co.uk>

next in thread | previous in thread | raw e-mail | index | archive | help
> > 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



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?49862a93.mPk92H%2B6FBE9Dl8m%perryh>