It might be more efficient to use the split
utility, because with tail
and head
in pipe you scan some parts of the file twice.
Example
split -l <k> <file> <prefix>
Where k
is the number of lines you want to have in each file, and the (optional) prefix
is added to each output file name.