dave@lsuc.uucp (David Sherman) (12/18/88)
Uh, why do you need a new tool for this? dd bs=512 count=100 if=$1 of=xaa dd bs=512 skip=100 count=100 if=$1 of=xab dd bs=512 skip=200 count=100 if=$1 of=xac If you need a more general tool, it'd be simple enough to hack up a sh loop using expr to increment the skip and output-file arguments appropriately. David Sherman The Law Society of Upper Canada Toronto -- Moderator, mail.yiddish { uunet!attcan att pyramid!utai utzoo } !lsuc!dave
les@chinet.chi.il.us (Leslie Mikesell) (12/19/88)
In article <1988Dec18.101912.5463@lsuc.uucp> dave@lsuc.uucp (David Sherman) writes: >Uh, why do you need a new tool for this? > >dd bs=512 count=100 if=$1 of=xaa >dd bs=512 skip=100 count=100 if=$1 of=xab >dd bs=512 skip=200 count=100 if=$1 of=xac Is there a way to do this using piped input? I once wanted to re-split the GNU emacs tar distribution and could not come up with a way to do it with the standard tools. It was in 17 files of approximately 200K and I wanted to make files of about 360K to store on PC disks. I did not have enough disk space for a 3rd copy so I was trying to use: cat * |script_using_dd but could not make it work. >If you need a more general tool, it'd be simple enough to >hack up a sh loop using expr to increment the skip and output-file >arguments appropriately. That was the approach I used in the script (minus the skip of course) but it did not seem to work, perhaps due to stdio buffering in the pipe getting lost between successive executions of dd. Les Mikesell
wescott@sauron.Columbia.NCR.COM (Mike Wescott) (12/20/88)
In article <1988Dec18.101912.5463@lsuc.uucp> dave@lsuc.uucp (David Sherman) writes: > Uh, why do you need a new tool for this? > > dd bs=512 count=100 if=$1 of=xaa > dd bs=512 skip=100 count=100 if=$1 of=xab > dd bs=512 skip=200 count=100 if=$1 of=xac There is an even easier way to shell script this. You can avoid the skip= by using stdin: for i in xaa xab xac ... do dd count=100 of=$i done < $1 Or even do it "right" and completely emulate split... We actually hacked a flag into the split(1) to do the split in terms of blocks rather than lines. -- -Mike Wescott mike.wescott@ncrcae.Columbia.NCR.COM
pavlov@hscfvax.harvard.edu (G.Pavlov) (12/20/88)
In article <1988Dec18.101912.5463@lsuc.uucp>, dave@lsuc.uucp (David Sherman) writes: > Uh, why do you need a new tool for this? > dd bs=512 count=100 if=$1 of=xaa > dd bs=512 skip=100 count=100 if=$1 of=xab > dd bs=512 skip=200 count=100 if=$1 of=xac > If you need a more general tool, .......... (etc) Good, you've got yours and now I have mine. Thanks to whoever it was who posted bsplit. greg pavlov, fstrf, amherst, ny
wnp@dcs.UUCP (Wolf N. Paul) (12/20/88)
In article <1512@sauron.Columbia.NCR.COM> wescott@sauron.Columbia.NCR.COM (Mike Wescott) writes: >In article <1988Dec18.101912.5463@lsuc.uucp> dave@lsuc.uucp (David Sherman) writes: >> Uh, why do you need a new tool for this? >> >> dd bs=512 count=100 if=$1 of=xaa (etc, rest deleted) > >We actually hacked a flag into the split(1) to do the split >in terms of blocks rather than lines. But the point of posting UNIX-compatible utilities to comp.sources.misc or elsewhere on the net is to serve those people who do not have access to genuine UNIX source, and thus are not in a position to hack anything into the split(1) ... And there are numerous times I can think of when a compiled tool is faster, or otherwise more convenient than a shell script or commandline construct. Anyone who disagrees, just simply doesn't have to keep this around or use it. -- Wolf N. Paul * 3387 Sam Rayburn Run * Carrollton TX 75007 * (214) 306-9101 UUCP: killer!dcs!wnp ESL: 62832882 DOMAIN: dcs!wnp@killer.dallas.tx.us TLX: 910-380-0585 EES PLANO UD