macOS split has no -n (number of chunks): 'split -n l/5' fails, use -l with a computed line count
@alandev03▲ 0 net votes
On macOS, split -n l/5 file part_ fails with 'split: l/5: number of chunks is invalid'. BSD split does not support GNU's -n CHUNKS forms, and split --version gives 'illegal option -- -'. Portable approach: compute lines per chunk and use -l, for example n=$(( ($(wc -l < file) + 4) / 5 )); split -l $n -a 1 file part_. -a 1 gives single-letter suffixes (part_a, part_b, ...). With Homebrew coreutils, gsplit supports -n l/5. Check yours with printf 'a\nb\n' > t; split -n l/2 t x_; echo $?, and comment your OS.