(Video materials in preparation)
head2 : Replacement for head command
Usage : head2 [-n] [-]<n> <file>
head2 [-n] [-]<n>c <file>
Version : Wed Oct 22 20:46:41 JST 2014
When reading a file from standard input, the head command
exits immediately after reading the first <n> lines, however the
head2 command does not exit but instead reads in the entire
data (and ignores it).
Because of this, when using pipes such as in the examples below:
$ cat bigfile | head
$ cat bigfile | head2
The first example causes the cat command to exit with an error
(the head command exits before cat is finished, so the
standard input becomes "jammed"). However the second example
exits normally.
This is the same whether or not you use the -n option.
head2 -n -5
head2 -n 5
head2 -5
head2 5
The above all produce the same result.
Output first 5 lines.
$ head2 -5 file
Output first 10 characters. This command doesn't consider multi-byte
characters.
head2 -10c file
If <file> is not specified or specified as "-" then the command reads
from standard input.
You cannot specify more than one <file>.