TL;DR

A little utility condensing the gist of head and tail.

heail is a little Perl program to get the head and tail of the input at the same time:

Local copy here.

If you’re wondering, its name comes from merging head with tail. Well, I didn’t like heil.

Call like this:

some-command | heail 5  # keep 5 lines from head and 5 lines from tail

Example:

$ for i in $(seq 1 10); do printf %s\\n "$i"; done | heail 3
1
2
3
...
8
9
10

It tries to do the right thing if the number of available lines fit within both limits.

There’s plenty of space for improvement… and for suggesting the right tool to do this. Waiting!