Split Large Text file into smaller parts


Let’s take an example where you need to run a script for a large file of 10 GB, what would the consequences be? Either it will take a lot of time or the program will crash. To avoid such situations we need to divide the text file into smaller parts accordingly.

Let’s get started with how to split a large GB of text file using Git Bash

If you don’t have Git/Git Bash, download at https://git-scm.com/download

To open git bash in the desired location go to the respective location, right click and select gitbash open here as shown below

The command to split the file according to the desired MB is as follows:

split filename.txt -b 150m

The result is as follows

To split the large file according to the lines the command is as follows:

split filename.txt -l 50l

These are two different ways to split a large text file in MB’s or from number of lines using GitBash. It’s simple, easy and quick.

Leave A Comment

Your email address will not be published. Required fields are marked *