SplitFile: splitting large text files


I have been working on a project for the last three months where large script files with millions lines of rows is scripted from a database. These script files often contains errors due to data from the old database that don’t fit into the new database.

The largest script files is up till 6GB and difficult to handle with with editors I have available – even in UltraEdit. Therefore, I have been looking for a proper tool for splitting these large files into smaller chunks. 10 years ago, I had some windows toools ported from UNIX, but I couldn’t find them any more, and had to write the tool myself.

I needed a tool that splitted a large file into smaller files with a number of lines or had a maximum size. In addition, it was desirable to be able to just pick a line range from the large file and write these lines into a new file.

Here is example executions with command line parameters:

SplitFile /INFILE:"C:\TFS\SplitFile\Lines.txt" /MAXSIZE:250
SplitFile /INFILE:"C:\TFS\SplitFile\Lines.txt" /MAXLEN:100000
SplitFile /INFILE:"C:\TFS\SplitFile\Lines.txt" /PICKLINES:100,150

Download source code: SplitFile.zip

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s