Much better design. Thanks.
/ from my iPhone 4 / On Sep 7, 2011, at 12:59 AM, Pádraig Brady <[email protected]> wrote: > On 09/07/2011 01:55 AM, Dave Yost wrote: >> Z% for x in 1 2 3 4 5 6 7 >> for> do echo $x ; done | split --lines=3 \ >> pipe> && for x in x?? ; do echo "=== $x" ; cat $x ; done >> === xaa >> 1 >> 2 >> 3 >> === xab >> 4 >> 5 >> 6 >> === xac >> 7 >> >> In some applications, you would like split to more evenly apportion the >> output to the files, like this: >> >> Z% for x in 1 2 3 4 5 6 7 >> for> do echo $x ; done | split --balanced --lines=3 \ >> pipe> && for x in x?? ; do echo "=== $x" ; cat $x ; done >> === xaa >> 1 >> 2 >> 3 >> === xab >> 4 >> 5 >> === xac >> 6 >> 7 >> > > So you'd like to distribute evenly across the last 2 buckets. > It seems like it would be more general to specify the number of buckets > instead and let split balance across them all, which is supported recently. > > $ seq 7 | split -nr/3; tail x?? > ==> xaa <== > 1 > 4 > 7 > > ==> xab <== > 2 > 5 > > ==> xac <== > 3 > 6 > > $ seq 7 > 7; split -nl/3 7; tail x?? > ==> xaa <== > 1 > 2 > > ==> xab <== > 3 > 4 > > ==> xac <== > 5 > 6 > 7 > > Would that suffice? > > cheers, > Pádraig.
