home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #30 / NN_1992_30.iso / spool / comp / unix / question / 14831 < prev    next >
Encoding:
Text File  |  1992-12-21  |  1.3 KB  |  42 lines

  1. Newsgroups: comp.unix.questions
  2. Path: sparky!uunet!psinntp!jpradley!jpr
  3. From: jpr@jpradley.jpr.com (Jean-Pierre Radley)
  4. Subject: Re: How to chop up an archive.tar.Z file like in the X distributions?
  5. Date: Sat, 19 Dec 1992 05:33:19 GMT
  6. Message-ID: <1992Dec19.053319.12598@jpradley.jpr.com>
  7. References: <1992Dec15.142232.1@cc.utah.edu>
  8. Organization: Unix in NYC
  9. Lines: 31
  10.  
  11. In article <1992Dec15.142232.1@cc.utah.edu> eyring@cc.utah.edu writes:
  12. >How to chop up an archive.tar.Z file like in the X distributions?
  13. >
  14. >Could someone tell me what unix utility was used to chop up 
  15. >the big archive.tar.Z files into the smaller but all the same
  16. >size files?
  17. >..
  18. >
  19. >But how did they get created, split and csplit on my system only works
  20. >on text and cuts binary files into all sort of sizes.
  21.  
  22. When I'm faced with this task, I run "chunk":
  23.  
  24. : chunk - breakup a file into SIZE chunks called PREFIX01, PREFIX02, ...
  25. # @(#) JPRadley 10 Jan 91
  26. [ ! -r "$1" ] && echo "Usage: $0 file [prefix [size]]" && exit
  27. IN=$1 
  28. PREFIX=${2:-chunk}
  29. SIZE=${3:-100000}
  30. N=0
  31. while :
  32. do
  33.     T=`expr $N + 1`
  34.     [ $T -le 9 ] && T=0$T
  35.     dd count=1 bs=$SIZE if=$IN skip=$N of=$PREFIX$T
  36.     [ ! -s $PREFIX$T ] && rm $PREFIX$T && break
  37.     N=`expr $N + 1`
  38. done
  39. l $PREFIX* $IN
  40. -- 
  41. Jean-Pierre Radley   Unix in NYC   jpr@jpr.com   jpradley!jpr   CIS: 72160.1341
  42.