On 12/01/2021 18:55, William Bader wrote:
lines=$(($(wc -l < "file") / 2))
split -l $lines file

Doesn't this need to round up to avoid leaving a third file with one line if 
the original file has an odd number of lines?

split -l $((($(wc -l < file) + 1) / 2)) file

Well dealing with remainders would be an argument for implementing
--number=L/N as it could distribute lines more evenly.

I.e. --number=L/N would be like l/N, but it would
try harder to evenly distribute lines,
by identifying the number of lines up front,
and determining which chunks would get an extra line
to cater for the remainders.

cheers,
Pádraig

Reply via email to