Museum

Home

Lab Overview

Retrotechnology Articles

Online Manuals

⇒ uniq(1) — OSF/1 1.0 (TIN) MIPS

Media Vault

Software Library

Restoration Projects

Artifacts Sought

Related Articles

comm(1)

sort(1)

uniq(1)  —  Commands

OSF

NAME

uniq − Removes or lists repeated lines in a file

SYNOPSIS

uniq [−c | −d | −u] [+number] [−number] [input-file] [output-file]

The uniq command reads standard input by default, or input_file, compares adjacent lines, removes the second and succeeding occurrences of a line, and writes to standard output or the specified file output_file. 

FLAGS

-cPrecedes each output line with a count of the number of times each line appears in the file.  This flag supersedes -d and -u. 

-dDisplays repeated lines only. 

-uDisplays unique lines only. 

-numberSkips over the first number-1 fields.  A field is a string of nonspace, nontab characters separated by tabs or spaces, or both, from adjacent data on the same line. 

+number
Skips over the first number-1 characters.  Fields specified by number are skipped before characters. 

DESCRIPTION

input_file and output_file must be different files. 

Repeated lines must be on consecutive lines to be found.  You can arrange them with the sort command before processing. 

EXAMPLES

To delete repeated lines in the following file called fruit and save it to a file named newfruit, enter:

uniq fruit newfruit

The file fruit contains the following lines:

apples
apples
bananas
cherries
cherries
peaches
pears

The file newfruit contains the following lines:

apples
peaches
pears
bananas
cherries

RELATED INFORMATION

Commands:  comm(1), sort(1). 

Typewritten Software • bear@typewritten.org • Edmonds, WA 98026