# The splitter package

[ Tags: mit, program, text ] [ Propose Tags ]

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.

## Properties

Versions 0.1.0.0 base (==4.*), directory (>=1.1 && <1.3), filepath (>=1.2 && <1.4), parsec (>=3), range (>=0.1 && <=0.2) [details] MIT (c) 2013 Robert Massaioli Robert Massaioli robertmassaioli@gmail.com Text https://bitbucket.org/robertmassaioli/splitter https://bitbucket.org/robertmassaioli/splitter/issues head: git clone git@bitbucket.org:robertmassaioli/splitter.git Mon Jul 1 12:33:29 UTC 2013 by RobertMassaioli NixOS:0.1.0.0 splitter 529 total (7 in the last 30 days) (no votes yet) [estimated by rule of succession] λ λ λ Docs not available Last success reported on 2016-12-21 Hackage Matrix CI

#### Maintainer's Corner

For package maintainers and hackage trustees

## Readme for splitter-0.1.0.0

[back to package description]

# 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:

• Written in Haskell and therefore Cross-Platform
• Very Efficient / Very Fast
• Does one job and does it well: in agreement with the Unix Philosophy.

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.