Date: Sun, 01 Feb 2009 08:11:18 -0500 From: William Gordon Rutherdale <will.rutherdale@utoronto.ca> To: FreeBSD Questions <freebsd-questions@freebsd.org> Subject: Re: Tool to uncat file Message-ID: <49859F76.3010707@utoronto.ca> In-Reply-To: <20090201140102.e9a9a41a.freebsd@edvax.de> References: <20090201140102.e9a9a41a.freebsd@edvax.de>
next in thread | previous in thread | raw e-mail | index | archive | help
$ man split This (split) is the standard unix utility to break a file up into pieces. It breaks it down either by a fixed number of lines or by a fixed number of bytes. Also the rules for dividing lines is simplistic: simple newline division, no special escape handling. If that doesn't suit your purpose, then you have to write your own custom split-like utility. I've done that in the past. For instance I once wrote a routine in Perl at work to divide Informix format .unl files (database dump), with special escape rules for newlines and special handling of binary data. For what you're describing you probably want to write a C program to do the job. -Will Polytropon wrote: > Dear list, > > 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. So the idea would be to look for specific byte pattern > and then start a new file each time it occurs on input. > > Is there such a tool, or any other ideas
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?49859F76.3010707>