uspTukubaiコマンドに関する様々な資料がここにあります。

 

 

魂内検索

DOCUMENTS

COMMAND

FORUM

UEC DOCS

VIDEO

 

Alphabetical list

(Video materials in preparation)

head2

Name

head2 : Replacement for head command

Synopsis

Usage   : head2 [-n] [-]<n>  <file>

          head2 [-n] [-]<n>c <file>

Version : Wed Oct 22 20:46:41 JST 2014

Description

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.

Example 1

Output first 5 lines.

$ head2 -5 file

Example 2

Output first 10 characters. This command doesn't consider multi-byte

characters.

head2 -10c file

Note

If <file> is not specified or specified as "-" then the command reads

from standard input.

You cannot specify more than one <file>.