Tool to uncat file

perryh at pluto.rain.com perryh at pluto.rain.com
Sun Feb 1 15:14:18 PST 2009


> > 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


More information about the freebsd-questions mailing list