bsplit?
Leslie Mikesell
les at chinet.chi.il.us
Sat Feb 3 15:51:34 AEST 1990
In article <1990Feb1.232040.26182 at cs.rochester.edu> ken at 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 at chinet.chi.il.us
More information about the Unix-pc.general
mailing list