Hitachi

Job Management Partner 1 Version 10 Job Management Partner 1/Advanced Shell Description, User's Guide, Reference, and Operator's Guide


tail command (displays the last part of files)

Organization of this page

Format

tail [-r] [-b num-blocks|-c num-bytes|-n num-lines|-num-lines] [path-name ...]

Description

This command outputs the last part of one or more files to the standard output. If no file is specified, the standard input is read as the input. The displayed portion of a file begins at a position that is expressed in units of bytes, lines, or blocks. All data found in the specified display range is displayed. No error occurs if there is no data within the specified range.

Arguments

A numeric value prefixed with the plus sign (+) indicates a position from the beginning of the input. For example, -c +2 starts displaying from the second byte from the beginning of the input.

A numeric value prefixed with a minus sign (-) or without a sign indicates a position from the end. For example, -n 2 indicates the second line from the end of the input. The default is -n 10, or 10 lines from the end of the input.

-r

Specifies that the display is to be line-by-line in reverse order.

When the -r option is specified together with the -b option, the display is line-by-line from the end of the file for the number of blocks specified in the -b option. If display starts from a position that is in the middle of a multibyte character, garbled characters might result.

When the -r option is specified together with the -c option, the display is line-by-line from the end of the file for the number of bytes specified in the -c option. If display starts from a position that is in the middle of a multibyte character, garbled characters might result.

When the -r option is specified together with the -n option or with num-lines specified, the display is line-by-line from the end of the file for the number of lines specified in num-lines or in the -n option.

When the -r option is specified by itself, all input lines are output line-by-line in reverse order from the end of the file. Specifying this option more than once does not result in an error.

-b num-blocks

Unless the -r option is specified, specifies the position from which to start displaying, in units of blocks (one block is 512 bytes).

A numeric value prefixed with a minus sign (-) or a numeric value without a sign indicates a position counted from the end of the input. A numeric value prefixed with the plus sign (+) indicates a position counted from the beginning of the input.

If num-blocks is omitted, the command displays usage information and terminates with an error message (tail: option requires an argument - option). If you specify a non-numeric value for num-blocks, an error message (tail: illegal offset -- specified-character-string) is output.

If display starts from a position that is in the middle of a multibyte character, garbled characters might result. End-of-line codes are included in the byte count. For example, in Windows, a linefeed [LF] counts as one byte, and [CR] + [LF] counts as two bytes. If this option is specified more than once, usage information is displayed.

-c num-bytes

Unless the -r option is specified, specifies the position from which to start displaying, in units of bytes.

A numeric value prefixed with a minus sign (-) or a numeric value without a sign indicates a position counted from the end of the input. A numeric value prefixed with a plus sign (+) indicates a position counted from the beginning of the input.

If num-bytes is omitted, the command displays usage information and terminates with an error message (tail: option requires an argument - option). If you specify a non-numeric value for num-bytes, an error message (tail: illegal offset -- specified-character-string) is output.

If display starts from a position that is in the middle of a multibyte character, garbled characters might result. End-of-line codes are included in the byte count. For example, in Windows, a linefeed [LF] counts as one byte, and [CR] + [LF] counts as two bytes. If this option is specified more than once, usage information is displayed.

-n num-lines|-num-lines

Unless the -r option is specified, specifies the position from which to start displaying, in units of lines.

A numeric value prefixed with a minus sign (-) or a numeric value without a sign indicates a position counted from the end of the input. A numeric value prefixed with a plus sign (+) indicates a position counted from the beginning of the input.

If num-lines is omitted, the command displays usage information and terminates with an error message (tail: option requires an argument - option). If you specify a non-numeric value for num-lines, an error message (tail: illegal offset -- specified-character-string) is output. If this option is specified more than once, usage information is displayed.

path-name

Specifies an input file. If no input file is specified, the standard input is read. Multiple input files can be specified. If you specify more than one file, each file is identified at the beginning of the output from that file by a blank line (linefeed) and its file name in a header string in the following format:

==> file-name <==

When you execute the tail command with multiple files specified, all the files are processed. If any file fails to open, the command terminates with a return code of 1.

Return codes

Return code

Meaning

0

Normal termination

1 or greater

Error termination

Notes

Usage examples