Path: utzoo!utgpu!watserv1!watmath!uunet!lll-winken!uwm.edu!cs.utexas.edu!asuvax!mcdphx!mcdchg!chinet!les From: les@chinet.chi.il.us (Leslie Mikesell) Newsgroups: unix-pc.general Subject: Re: bsplit? Message-ID: <1990Feb3.045134.26715@chinet.chi.il.us> Date: 3 Feb 90 04:51:34 GMT References: <12897@cbnewsc.ATT.COM> <26143@cup.portal.com> <1990Jan23.040408.27311@banzai.PCC.COM> Reply-To: les@chinet.chi.il.us (Leslie Mikesell) Organization: Chinet - Chicago Public Access UNIX Lines: 30 In article <1990Feb1.232040.26182@cs.rochester.edu> ken@cs.rochester.edu writes: >> for i in 1 2 3 4 5 >> do >> dd bs=10k count=1 of=part$i >> done < foo > >Another approach would be to precompute the number of parts >needed and generate fixed width numbers by prepadding with zeros, then >trimming to the final width with sed. The fixed width numbers are easy with something like: (3 digits) case $i in ?) i=00$i ;; ??) i=0$i ;; esac The real problem, though is that you can't feed the script from a pipe. dd is almost unique among the unix tools in that it uses read() rather than fread() and will fail to read the requested amount if the input pipeline cannot stay ahead. >No doubt somebody will suggest a perl version next. :-) Good idea... Les Mikesell les@chinet.chi.il.us