1UNIQ(1) User Commands UNIQ(1)
2
3
4
6 uniq - report or omit repeated lines
7
9 uniq [OPTION]... [INPUT [OUTPUT]]
10
12 Filter adjacent matching lines from INPUT (or standard input), writing
13 to OUTPUT (or standard output).
14
15 With no options, matching lines are merged to the first occurrence.
16
17 Mandatory arguments to long options are mandatory for short options
18 too.
19
20 -c, --count
21 prefix lines by the number of occurrences
22
23 -d, --repeated
24 only print duplicate lines, one for each group
25
26 -D print all duplicate lines
27
28 --all-repeated[=METHOD]
29 like -D, but allow separating groups with an empty line;
30 METHOD={none(default),prepend,separate}
31
32 -f, --skip-fields=N
33 avoid comparing the first N fields
34
35 --group[=METHOD]
36 show all items, separating groups with an empty line;
37 METHOD={separate(default),prepend,append,both}
38
39 -i, --ignore-case
40 ignore differences in case when comparing
41
42 -s, --skip-chars=N
43 avoid comparing the first N characters
44
45 -u, --unique
46 only print unique lines
47
48 -z, --zero-terminated
49 line delimiter is NUL, not newline
50
51 -w, --check-chars=N
52 compare no more than N characters in lines
53
54 --help display this help and exit
55
56 --version
57 output version information and exit
58
59 A field is a run of blanks (usually spaces and/or TABs), then non-blank
60 characters. Fields are skipped before chars.
61
62 Note: 'uniq' does not detect repeated lines unless they are adjacent.
63 You may want to sort the input first, or use 'sort -u' without 'uniq'.
64
66 Written by Richard M. Stallman and David MacKenzie.
67
69 GNU coreutils online help: <https://www.gnu.org/software/coreutils/>
70 Report any translation bugs to <https://translationproject.org/team/>
71
73 Copyright © 2022 Free Software Foundation, Inc. License GPLv3+: GNU
74 GPL version 3 or later <https://gnu.org/licenses/gpl.html>.
75 This is free software: you are free to change and redistribute it.
76 There is NO WARRANTY, to the extent permitted by law.
77
79 comm(1), join(1), sort(1)
80
81 Full documentation <https://www.gnu.org/software/coreutils/uniq>
82 or available locally via: info '(coreutils) uniq invocation'
83
84
85
86GNU coreutils 9.1 January 2023 UNIQ(1)