home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.unix.questions
- Path: sparky!uunet!psinntp!jpradley!jpr
- From: jpr@jpradley.jpr.com (Jean-Pierre Radley)
- Subject: Re: How to chop up an archive.tar.Z file like in the X distributions?
- Date: Sat, 19 Dec 1992 05:33:19 GMT
- Message-ID: <1992Dec19.053319.12598@jpradley.jpr.com>
- References: <1992Dec15.142232.1@cc.utah.edu>
- Organization: Unix in NYC
- Lines: 31
-
- In article <1992Dec15.142232.1@cc.utah.edu> eyring@cc.utah.edu writes:
- >How to chop up an archive.tar.Z file like in the X distributions?
- >
- >Could someone tell me what unix utility was used to chop up
- >the big archive.tar.Z files into the smaller but all the same
- >size files?
- >..
- >
- >But how did they get created, split and csplit on my system only works
- >on text and cuts binary files into all sort of sizes.
-
- When I'm faced with this task, I run "chunk":
-
- : 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
-