I have a large text file, that I need to split into a series of smaller (under 1MB) files. It seems that
split is what I want here.
However, if I try the following (using 900k as the limit to give some buffer before the hard limit of 1MB):
split -a 2 -b 900k total.sql createtables_
It will make each part exactly 900k (except the last part), most likely splitting lines at places where it splits the file.
So, is there a way to make it only split on line boundaries? In other words, have it make the pieces as close as possible (without going over) the limit specified in the
-b argument, ensuring it only splits on line boundaries?
Or is the only option to use the
-l option to split to split based on line count, and just use trial and error to find the parameter than keeps all files under the limit?
split not the right tool to be using?