coreutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: split: Allow splitting by line count (instead of byte size)


From: William Bader
Subject: Re: split: Allow splitting by line count (instead of byte size)
Date: Tue, 12 Jan 2021 18:55:07 +0000

> 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


reply via email to

[Prev in Thread] Current Thread [Next in Thread]