[net.sources] Simple binary file splitter

dan@rna.UUCP (Dan Ts'o) (11/18/84)

xyzzy

	Here is a simple shell script which splits a file with arbitrary
contents into 32kilobyte pieces. I have found this command (bsplit) useful
for breaking up large binary files such as TAR archives and UNIX file
systems (!) before transmission via UUCP or MAIL (must hex as well).
I have also found that files in the 10-50kb range are a good compromise
between UUCP overhead and UUCP failures.
	I hope this is useful...

					Cheers,
					Dan Ts'o
					Dept. Neurobiology
					Rockefeller Univ.
					1230 York Ave.
					NY, NY 10021
					212-570-7671
					...cmcl2!rna!dan
__________bsplit__________
case x$1 in
	x)
		echo Usage: bsplit file ... 1>&2
		exit
		;;
esac
fs=32k
for file
do
	i=0
	while :
	do
		nfile=${file}.${i}
		dd bs=$fs if=$file of=$nfile count=1 skip=$i 2>&1 | grep -v records 1>&2
		if [ ! -s $nfile ]
		 then
			rm -f $nfile
			echo $file split into $i files. 1>&2
			break
		fi
		i=`expr $i + 1`
	done
done