3 Methods To Split Text Files After A Certain Line: Manually, TextWedge, Linux

Text files can become quite large depending on what you are processing and should be split. Some services such as Amazon’s S3 won’t accept batches larger than 500 or 1000 lines. In this guide I will show you 3 methods to split files

Method 1: Manually Using Notepad++

Let’s say you have 1 single text file with 3000 lines and you need 1 text file to be no larger than 500 files, then it is far easier to manually split the text files instead of having to deal with some tool you have never used before.

Download Notepad++ and go into the file. Go to the first line, hold ALT and your left mouse button, then drag it down quickly.

Using Notepad Plus Plus To Split Text Files.png

Now the drag method is rather slow, but you can speed it up by quickly moving the mouse up and down while while holding ALT.

This method will work just fine and allow you to split a file in less than 5-15 minutes depending on the size.

Method 2: TextWedge

TextWedge is a simple tool, but it requires a split pattern. So, if you don’t want to add some patterns manually, this may not work for you. However, it works great if you only need to split a very large file that you cant open manually (although notepad++ can easily handle 100,000+ lines I believe, never tested it).

Download it here

EASIEST Method 3: Linux

Do you have access to a Linux machine? Great!

The split command allows you to easily split text files. Let’s say the file is 50,000 lines long and you want to split it into 10,000 line files:

split -l 10000 /home/user/file splitfiles

All you have to specify is the number of lines to split after (-l 10000), the source file (/home/user/file) and the target filename (splitfiles). This will then split the file in the original directory using the name splitfilesa, splitfilesb, splitfilesc and so on.

Published: Monday, October 20th, 2014 Last Modified: October 20, 2014

Related Posts

Rate This Article
3 of 5 0 (60%) 2 votes