split

split is used to split files by number of lines. I believe it's part of GNU coreutils, so you may need to install that.

Example usage

# To split file `filename.txt` by every 10 lines
split -l 10 filename.txt
# This makes a bunch of ten-line files named `xaa`, `xab`, etc.

# To use numerical suffixes
split -l 10 --numeric-suffixes filename.txt output
# Outputs `output01`, `output02`, etc.

References

  1. Man page for split(1)

Last modified: 202511260037