# linsel
> **lin**e **sel**ector
A small program that prints out selected lines from its input.
## Installation
Install in the standard way for Rust programs:
```shell
cargo install --bins linsel
```
## Usage
`linsel` takes any number of arguments of the form `<start>-<end>/<step>`, which
means "print out every `<step>`th line from `<start>` to `<end>`, inclusive".
The hyphen can also be replaced with a colon: `<start>:<end>/<step>`.
Line numbers are 1-based: the first line of input is numbered 1, not 0. Any line
selected by any of the arguments will be printed, but each line is only printed
once.
```console
6
8
10
11
14
17
```
There are various abbreviated forms:
- If `<start>` is omitted, printing begins with the first line of input.
- If `<end>` is omitted, printing extends all the way to the last line of input.
- If `/<step>` is omitted, the step defaults to 1.
- A single number `<n>` means exactly line `<n>`, equivalent to `<n>-<n>/1`.
```console
2
$ seq 10 | linsel 9-
9
10
$ seq 10 | linsel 4
4
```
### Recipes
- `head -n <NUM>` is equivalent to `linsel -<NUM>`
- `head -n -<NUM>` is equivalent to `linsel <NUM>-`
## Why "linsel"?
Plus the name rhymes with "tinsel" and I think that's kind of cute. But really,
it's mostly because naming is hard, this one was unclaimed, and I didn't come up
with anything better in a few days.