Uniq
Template:Short description
Template:About
Template:Lowercase title
{{#invoke:Infobox|infobox}}Template:Template other {{#invoke:Check for unknown parameters|check|unknown=Template:Main other|preview=Page using Template:Infobox software with unknown parameter "_VALUE_"|ignoreblank=y| AsOf | author | background | bodystyle | caption | collapsetext | collapsible | developer | discontinued | engine | engines | genre | included with | language | language count | language footnote | latest preview date | latest preview version | latest release date | latest release version | latest_preview_date | latest_preview_version | latest_release_date | latest_release_version | licence | license | logo | logo alt | logo caption | logo class | logo size | logo title | logo upright | logo_alt | logo_caption | logo_class | logo_size | logo_title | logo_upright | middleware | module | name | operating system | operating_system | other_names | platform | programming language | programming_language | qid | released | replaced_by | replaces | repo | screenshot | screenshot alt | screenshot class | screenshot size | screenshot title | screenshot upright | screenshot_alt | screenshot_class | screenshot_size | screenshot_upright | service_name | size | standard | title | ver layout | website }}Template:Main other{{#invoke:Check for conflicting parameters|check
| template = Template:Infobox software
| cat = Template:Main other
| logo size; logo_size
| logo class; logo_class
| logo alt; logo_alt
| logo title; logo_title
| logo caption; logo_caption
| screenshot size; screenshot_size
| screenshot upright; screenshot_upright
| screenshot class; screenshot_class
| screenshot alt; screenshot_alt
| screenshot title; screenshot title
| latest release version; latest_release_version
| latest release date; latest_release_date
| latest preview version; latest_preview_version
| latest preview date; latest_preview_date
| latest release version; latest_release_version
| latest release date; latest_release_date
| latest preview version; latest_preview_version
| latest preview date; latest_preview_date
| programming language; programming_language
| operating system; operating_system
}}
uniq is a utility command on Unix, Plan 9, Inferno, and Unix-like operating systems which, when fed a text file or standard input, outputs the text with adjacent identical lines collapsed to one, unique line of text.
Overview
The command is a kind of filter program. Typically it is used after sort. It can also output only the duplicate lines (with the -d option), or add the number of occurrences of each line (with the -c option). For example, the following command lists the unique lines in a file, sorted by the number of times each occurs:
<syntaxhighlight lang="sh"> $ sort file | uniq -c | sort -n </syntaxhighlight>
Using uniq like this is common when building pipelines in shell scripts.
History
First appearing in Version 3 Unix,[1] uniq is now available for a number of different Unix and Unix-like operating systems. It is part of the X/Open Portability Guide since issue 2 of 1987. It was inherited into the first version of POSIX and the Single Unix Specification.[2]
The version bundled in GNU coreutils was written by Richard Stallman and David MacKenzie.[3]
A uniq command is also part of ASCII's MSX-DOS2 Tools for MSX-DOS version 2.[4]
The command is available as a separate package for Microsoft Windows as part of the GnuWin32 project[5] and the UnxUtils collection of native Win32 ports of common GNU Unix-like utilities.[6]
The Template:Mono command has also been ported to the IBM i operating system.[7]
See also
References
External links
- Template:Man
- Template:Man
- Template:Man
- SourceForge UnxUtils – Port of several GNU utilities to Windows
Template:Unix commands Template:Plan 9 commands Template:Core Utilities commands
- ↑ Template:Cite tech report
- ↑ Template:Man
- ↑ Template:Man
- ↑ MSX-DOS2 Tools User's Manual by ASCII Corporation
- ↑ {{#invoke:citation/CS1|citation |CitationClass=web }}
- ↑ {{#invoke:citation/CS1|citation |CitationClass=web }}
- ↑ {{#invoke:citation/CS1|citation |CitationClass=web }}