hi,

since i see many solutions, i thought i will add mine too (if you can
use inferno). attached please see the limbo program i wrote for this.
it has helped me many times: didnt have to come out with parameters
for dd commands which i used to use before for this kind of tasks.

please note that the program is very crude. i am sending it as is.

thanks
dharani

On Mon, May 10, 2010 at 12:57 AM, roger peppe <rogpe...@gmail.com> wrote:
> On 8 May 2010 18:35, Russ Cox <r...@swtch.com> wrote:
>> bs=1474560
>> cat $file | for(i in `{seq 0 `{ls -l $file | awk '{print
>> int($6)/'$bs'}'}}) { dd -bs $bs -count 1 -of $file.$i }
>
> that looks very plausible, but it doesn't actually work,
> as awk doesn't coelesce short reads (it gets short
> reads from the pipe)
>
> this works a little better:
>
> bs=1474560
> {for(i in `{seq 0 `{ls -l $file | awk '{print
> int($6)/'$bs'}'}}) { dd -bs $bs -count 1 -of $file.$i -quiet 1 }} < $file
>
> but there's still a little annoyance - if the file size is an exact
> multiple of the block size, it will generate an unnecessary zero-length
> file at the end.
>
> i tried to fix it to get rid of this, but ran hard up against awk's
> dismalness. to illustrate:
>
> % seq 106908504 106908509 | awk '{print $1 % 4}'
> 0
> 0
> 0
> 0
> 0
> 0
> %
>
> oh dear.
>
>

Attachment: splitcp.b
Description: chemical/molconn-z

Reply via email to