[comp.unix.questions] binary split

hitt@neon.Stanford.EDU (Daniel Hitt) (03/17/91)

Is there an analogue of the split command that instead of working on
the basis of lines works on the basis of characters?

That is, one would type
splitPrime -200000 afile z
and afile would be split into chunks of 200000 bytes in files named
z00 z01 z02 . . . (the suffixes being a function of how large afile is).

Of course, one can easily write such a program, but i'd prefer to use
a standard tool if there is one (because i can use it in scripts on
different machines, etc.).

If this is an RTFM question, please give me the section and command name.

Thanks for any info anyone can provide.

dan
(hitt@neon.stanford.edu)

jik@athena.mit.edu (Jonathan I. Kamens) (03/18/91)

  The 4.3BSD split program tries to notice when files it's trying to split are
binary, and act appropriately when they are.  Unfortunately, the code that
does this is somewhat buggy and doesn't always work.

  The 4.3tahoe (and probably 4.3reno as well) split has an explicit
command-line flag you can give it to tell it to act like it's splitting a
binary file, instead of a text file.  If you don't give it the option, it
always assumes that the file you're trying to split is a text file.  So you
could snarf the sources to split from the /bsd-sources directory on
uunet.uu.net, although you might have a bit of trouble compiling it if you
don't have ANSI C header files.

  If you don't want to do that, you can get the "bsplit" program in the
comp.sources.misc archives at any comp.sources.misc archive site (including
/comp.sources.misc on uunet.uu.net).  In general, it is a good idea to check
the archives on uunet.uu.net (or some other archive site that archives most
source newsgroups) before posting a question like this to the net.  I found
out about bsplit by typing getting the comp.sources.misc index file from
uunet.uu.net and grepping for the word "split" in it.

-- 
Jonathan Kamens			              USnail:
MIT Project Athena				11 Ashford Terrace
jik@Athena.MIT.EDU				Allston, MA  02134
Office: 617-253-8085			      Home: 617-782-0710