# split¶

## @split ( input, output, [extras,...] )¶

Purpose:
Splits a single set of input into multiple output, where the number of output may not be known beforehand.
Only out of date tasks (comparing input and output files) will be run

Example:

@split("big_file", '*.little_files')
def split_big_to_small(input_file, output_files):
print "input_file = %s" % input_file
print "output_file = %s" % output_file


.

will produce:

input_file = big_file
output_file = *.little_files


Parameters:

can be a:

1. (Nested) list of file name strings (as in the example above).

File names containing *[]? will be expanded as a glob.
E.g.:"a.*" => "a.1", "a.2"

File names are taken from the output of the specified task(s)

• output = output

Specifies the resulting output file name(s) after string substitution

Can include glob patterns (e.g. "*.txt")

These are used only to check if the task is up to date.
Normally you would use either a glob (e.g. *.little_files as above) or a “sentinel file” to indicate that the task has completed successfully.
You can of course do both:
@split("big_file", ["sentinel.file", "*.little_files"])
def split_big_to_small(input_file, output_files):
pass

• extras = extras

Any extra parameters are passed verbatim to the task function

If you are using named parameters, these can be passed as a list, i.e. extras= [...]

Any extra parameters are consumed by the task function and not forwarded further down the pipeline.

Warning

Deprecated since Ruffus v 2.5

@split( input, output, filter = regex(...), add_inputs(...) | inputs(...), [|extras|_,...] ) is a synonym for @subdivide.