Subject: bug#20511: split : does not account for --numeric-suffixes=FROM in calculation of suffix length?

From: Pádraig Brady <[email-masked]>
Date: Wed, 06 May 2015 18:48:08 +0100

On 06/05/15 18:37, Ben Rusholme wrote:
> Hi,
> 
>> 4. Auto set the suffix len based on FROM + CHUNK.
>> That would support use case 1 (single run),
>> but _silently_ break subsequent processing order
>> of outputs from multiple split runs
>> (as FROM is increased in multiples of CHUNK size).
>> We could mitigate the _silent_ breakage though
>> by limiting this change to when FROM < CHUNK.
>>
>> 5. Document in man page and with more detail in info docs
>> that -a is recommended when specifying FROM
>>
>> So I'll do 4 and 5 I think.
> 
> Thanks, that would solve the problem I was having.
> 
> Please feel free to end this conversation here, but if you can spare the time I’d be very interested in an example of a multiple split run for my own education/understanding/curiosity? I assume you mean processing subsets of the input, but can’t see how to do that (after experimenting on the command line and searching the documentation) except —number=l/k/n which does know the size of the total set?

Well you could process subsets but even more simply
consider splitting a set of input files in 2,
to a set of output files.

  i=0
  for f in *.dat; do
    split -a4 --numeric=$i $f -n2; i=$(($i+2))
  done

(to be truely generic you would set the -a parameter
 based on the number of files and -n).

cheers,
Pádraig.