UNIQ(1)
π UNIQ(1) β the Perl one, bestie π
okay so this is uniq, a User Contributed Perl Documentation page, and honestly? it's giving "tiny tool, huge main character energy." it dedupes adjacent lines and that's the whole vibe. let's get into it π«Ά
β¨ NAME β¨
uniq β report or filter out repeated lines in a file
πΈ SYNOPSIS πΈ
uniq [-c | -d | -u] [-f fields] [-s chars]
[input_file [output_file]]
π¦ DESCRIPTION π¦
ok so here's the whole thing: uniq reads standard input, compares adjacent lines, and writes a copy of each unique input line to standard output. the second and succeeding copies of identical adjacent input lines? not written. gone. not invited to the group chat π
β οΈ real talk: repeated lines that are not adjacent will not be detected. so if your dupes are scattered all over, you may need to sort the files first. iykyk π
here are the options that are available:
-cβ precede each output line with the count of the number of times the line occurred in the input, followed by a single space. slay, now you know how popular each line was π₯-dβ don't output lines that are not repeated in the input. so you only see the ones with duplicates. iconic filtering β¨-ffields β ignore the first fields in each input line when doing comparisons. a field is a string of non-blank characters separated from adjacent fields by blanks. field numbers are one based, i.e. the first field is field one. no cap, one-based is real π-schars β ignore the first chars characters in each input line when doing comparisons. and if you specify it in conjunction with the-foption, the first chars characters after the first fields fields will be ignored. character numbers are one based too, i.e. the first character is character one π-uβ don't output lines that are repeated in the input. the opposite of-d, we stan a duo π
and if additional arguments are specified on the command line, they are used as the names of input files. simple as that π§
the uniq utility exits 0 on success or >0 if an error occurred. she tells you when something's wrong, we love an honest queen π
β COMPATIBILITY β
the historic -number and +number options are supported as synonyms for -f fields and -s chars, respectively. retro but make it fashion π
this version accepts 0 as a valid argument for the -f and -s switches β some implementations of uniq do not. so yeah, we're the chill one π«Ά
π SEE ALSO π
sort(1)β the bestie you call when your dupes aren't adjacent, fr fr
π BUGS π
uniq has no known bugs. not me being flawless ππ
periodt.
π AUTHOR π
the Perl implementation of uniq was written by Jonathan Feinberg, jdf@pobox.com. ty bestie for your service π«‘π
π COPYRIGHT and LICENSE π
this program is copyright (c) Jonathan Feinberg 1999.
this program is free and open software. you may use, modify, distribute, and sell this program (and any modified variants) in any way you wish, provided you do not restrict others from doing the same. that's the whole license, no fine print, we love to see it β¨π
that's the whole page bestie, go forth and dedupe π¦
cute little sign-off: this was perl v5.42.2, dated 2026-02-15 β mwah, bye π
π¦ where this page comes from
- alpine 3.24: perl-power-tools-doc 1.053-r1 Β· GPL-2.0-or-later AND Artistic-1.0-Perl AND Artistic-2.0 AND BSD-2-Clause
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms