Splitting Files using Linux Command Line
Updated: August 11, 2018
I have yet to find a text editor capable of modifying multi-GB text files on Linux, as EmEditor only works with Windows.
So if you ever need to split a text file into smaller pieces, then you can use the following command:
$ split -l NUMBEROFLINES FILENAME.EXT
If you had a file named
data.json and wanted to split it on every 100.000 lines, then you could run:
$ split -l 100000 data.json
Similarly, you can also split files based on filesize rather than number of lines. If you want to split the
data.json file on every 200MB while ensuring files are split on linebreaks, then you can run the following command:
$ split -C 200m data.json
If you’re running into any trouble or have questions, then feel free to open an issue on this repo.