Hitachi

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


uniq command (removes duplicated lines from a sorted file)

Organization of this page

Format

uniq [-c] [-d] [-u] [input-path-name [output-path-name]]

Description

This command outputs the results of consolidating duplicated lines in a file into single lines. Note that lines with identical content are considered to be duplicates only if they are consecutive.

Arguments

If no options are specified, the processing is the same as when the -d and -u options are both specified. That is, the command outputs duplicate lines as a single line, and it also outputs all non-duplicate lines.

-c

Specifies that each output line is to be preceded by a count of the number of times the line occurred, followed by a single space. A count is displayed as a four-digit number, but the number of digits will be increased if necessary to accommodate values that exceed four digits. A single space is displayed after each count.

-d

Specifies that only duplicate lines are to be output.

-u

Specifies that only lines that had no duplicates are to be displayed.

input-path-name

Specifies the input file. If input-path-name is not specified or is specified as -, the standard input is read.

output-path-name

Specifies the output file for the results. If output-path-name is not specified or is specified as -, the standard output is assumed.

Return codes

Return code

Meaning

0

Normal termination

1 or greater

Error termination

Notes

Usage examples

The following shows the format of the file used in the examples below to illustrate the results of executing the uniq command.

The file listed above is used as the input file in the following examples.