The splitter package

[Tags: mit, program]

Splitter lets you specify numerical ranges to split out certain lines from a file. This means that you can extract exactly what you want from a file and only the sections that you want. Or, if you are only interested in a log file after a certain preamble then you can specify that range of files too.

[Skip to ReadMe]


Change logNone available
Dependenciesbase (==4.*), directory (>=1.1 && <1.3), filepath (>=1.2 && <1.4), parsec (>=3), range (>=0.1 && <=0.2) [details]
Copyright(c) 2013 Robert Massaioli
AuthorRobert Massaioli
Home page
Bug tracker
Source repositoryhead: git clone
UploadedMon Jul 1 12:33:29 UTC 2013 by RobertMassaioli
Downloads281 total (8 in last 30 days)
0 []
StatusDocs not available [build log]
Last success reported on 2015-09-30 [all 5 reports]


Maintainers' corner

For package maintainers and hackage trustees

Readme for splitter-


Author: Robert Massaioli

Welcome to the splitter program written in Haskell. The purpose of this program is to allow an easy way to extract ranges of lines from text files. Programs like head and tail extract from the beginning and ends of files and programs like cat print out the entire file. But what if you want to extract lines 101-127 in a file? This is the exact problem that splitter was designed to solve and you can do that like this:

splitter 101-127

Features include:

It is my hope that this tool becomes a valuable part of your toolkit and, if it does, then please feel free to send me an email telling me about it.

Example Invocations

Extract a few choice prime lines from a file:

splitter 2,3,5,7,11,13

Semantically all of the arguments are concatenated together using the ',' symbol meaning that the previous line is identical to this one:

splitter 2 3 5 7 11 12

You can extract spans of lines. For example, getting lines ten to twenty and thirty to eighty would be done like so:

splitter 10-20 30-80

You can extract ranges of lines that are bound on only one end. So if you wanted to extract everything from line fourty onwards then you could do the following:

splitter 40-

You can of course perform the reverse operation and get all the lines counting upto and including fourty:

splitter -40

And, if you really want to then you can just get all of the lines in the file:

splitter *    # This is the same as the 'cat' program

And that is all that there is to it. There are a few extra useful options such as the invert range and number lines options that invert the ranges you selected and add original line numbers next to the output. For more information run the help command.

Important All ranges you can select are inclusive, so 10-20 will include lines ten and twenty. In mathematical notation all ranges are square brackets and not round brackets.

Installation Instructions

Install it just like a normal haskell program. Download the source and then just:

cabal install

And make sure that your cabal bin directory is in your environments PATH variable. That is all that there is to it.

If you wish to have a play around with it first before installing it in your cabal/bin directory then you may wish to install it first in a cabal-dev environment.

Command Line Options

You can get these by simply asking for help:

$ splitter -h
Usage: split [options] <input>
  -n      --numbers  include line numbers in final output
  -i      --invert   get the opposite of the lines specified
  -V, -v  --version  print version number
  -H, -h  --help     print this help message

And that is everything that you can currently do with the splitter program.