🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: alt.sources.d
Article #1533

Re: nsplit - split files into byte-sized chunks

#1533
From: Jean-Pierre Radley
Date: Thu, 17 Dec 1992 22:13
29 lines
1508 bytes
In alt.sources, in article <1992Dec14.173641.28115@vela.acs.oakland.edu> amaranth@vela.acs.oakland.edu (Paul Amaranth) writes:
>/*                                                              */
>/* I wrote this because I am forever taking tar files, splitting*/
>/* them into chunks and putting them onto dos diskettes for     */
>/* transfer.  Feel free to use it however you like.             */
>/*                                                              */

I'm constantly faced with chopping up giant files into parts; your compiled
program is no doubt much faster, but I've found this shell program adequate
for the purpose:

: chunk - breakup a file into SIZE chunks called PREFIX01, PREFIX02, ...
# @(#) JPRadley 10 Jan 91
[ ! -r "$1" ] && echo "Usage: $0 file [prefix [size]]" && exit
IN=$1 
PREFIX=${2:-chunk}
SIZE=${3:-100000}
N=0
while :
do
	T=`expr $N + 1`
	[ $T -le 9 ] && T=0$T
	dd count=1 bs=$SIZE if=$IN skip=$N of=$PREFIX$T
	[ ! -s $PREFIX$T ] && rm $PREFIX$T && break
	N=`expr $N + 1`
done
l $PREFIX* $IN
-- 
Jean-Pierre Radley   Unix in NYC   jpr@jpr.com   jpradley!jpr   CIS: 72160.1341
Technical Details
Message-ID: <1992Dec17.221306.29049@jpradley.jpr.com>
Path: arc1-ca.pugleaf.net!sparky!uunet!murphy!jpradley!jpr
References: <1992Dec14.173641.28115@vela.acs.oakland.edu>

Show Full Headers
Complete Article Headers
Newsgroups: alt.sources.d
Path: arc1-ca.pugleaf.net!sparky!uunet!murphy!jpradley!jpr
From: jpr@jpradley.jpr.com (Jean-Pierre Radley)
Subject: Re: nsplit - split files into byte-sized chunks
Date: Thu, 17 Dec 1992 22:13:06 GMT
Message-ID: <1992Dec17.221306.29049@jpradley.jpr.com>
References: <1992Dec14.173641.28115@vela.acs.oakland.edu>
Organization: Unix in NYC
Lines: 29