Uniq

Uniq

uniq is a Unix utility which, when fed a text file, outputs the file with adjacent identical lines collapsed to one. It 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).

An example: To see the list of lines in a file, sorted by the number of times each occurs::sort file | uniq -c | sort -n

Using uniq like this is common when building pipelines in shell scripts. Be careful, uniq expects its input to be already sorted; sometimes sort -u is what you need.

witches

*-u Print only lines which are not repeated in the original file
*-d Don't output lines that are not repeated in the input.
*-c Generate an output report in default style except that each line is preceded by a count of the number of times it occurred. If this option is specified, the -u and -d options are ignored if either or both are also present.
*-i Ignore case differences when comparing lines
*-s Skips a number of characters in a line
*-w Specifies the number of characters to compare in lines, after any characters and fields have been skipped
*--help Displays a help message
*--version Displays version number on stdout and exits.

ee also

*List of Unix programs

External links

* [http://www.linuxmanpages.com/man1/uniq.1.php uniq's] Linux manpage


Wikimedia Foundation. 2010.

Игры ⚽ Нужно решить контрольную?

Look at other dictionaries:

  • uniq — uniq·ui·ty; …   English syllables

  • Uniq — (bis 1999 Unigate) ist ein börsennotierter britischer Lebensmittelkonzern, spezialisiert auf Herstellung und Vertrieb von Kühl und Tiefkühlkost, insbesondere Salate, Desserts, Sandwiches, Wraps, Dips, Soßen, Dressings und Fertiggerichte. Die Uniq …   Deutsch Wikipedia

  • Uniq — утилита Unix, с помощью которой можно вывести или отфильтровать повторяющиеся строки в файле. Если входной файл задан как (« ») или не задан вовсе, чтение производится из стандартного ввода. Если выходной файл не задан, запись производится в… …   Википедия

  • Uniq — est une commande Unix qui affiche les lignes apparaissant plusieurs fois dans un fichier. On l utilise souvent après un sort. Exemple d utilisation $ sort file | uniq c | sort n permet de trier les lignes de file selon le nombre de fois où elles… …   Wikipédia en Français

  • uniq — утилита Unix, с помощью которой можно вывести или отфильтровать повторяющиеся строки в файле. Если входной файл задан как (« ») или не задан вовсе, чтение производится из стандартного ввода. Если выходной файл не задан, запись производится в… …   Википедия

  • uniq — est une commande Unix qui affiche les lignes apparaissant plusieurs fois dans un fichier. On l utilise souvent après un sort. Exemple d utilisation $ sort file | uniq c | sort n permet de trier les lignes de file selon le nombre de fois où elles… …   Wikipédia en Français

  • UNIQ — is a nightclub in the centre of Helsinki, Finland, near the main building of the Helsinki University.It is situated in the basement floor (one floor underground) of an office building housing a university research centre and an independent… …   Wikipedia

  • UniQ — es una organización de defensa de los derechos civiles y difusión de información que congrega a los estudiantes no heterosexuales de las universidades neocelandesas. El nombre UniQ es una contracción de universidad y queer (en inglés raro), el… …   Enciclopedia Universal

  • UniQ — Universidad Queer (UniQ) Acrónimo UniQ Tipo ONG Sede …   Wikipedia Español

  • UniQ — In New Zealand, UniQ is the Queer Students Association at New Zealand Tertiary Institutions. UniQ is active at all New Zealand universities and several polytechnics. In New Zealand, the term queer has been reclaimed that is, it was once (and by… …   Wikipedia

Share the article and excerpts

Direct link
Do a right-click on the link above
and select “Copy Link”