| Main index | Section 1 | 日本語 | Deutsch | Options |
The following options are available:
| | |
| Precede each output line with the count of the number of times the line occurred in the input, followed by a single space. | |
| | |
|
Output a single copy of each line that is repeated in the input.
Ignored if
| |
| | |
|
Output all lines that are repeated (like
| |
| none | Do not separate groups of lines (this is the default). |
| prepend | Output an empty line before each group of lines. |
| separate | Output an empty line after each group of lines. |
| | Ignore the first num 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. |
| | Case insensitive comparison of lines. |
| |
Ignore the first
chars
characters in each input line when doing comparisons.
If specified in conjunction with the
|
| | Only output lines that are not repeated in the input. |
Madrid Lisbon Madrid
The following command reports three different lines since identical elements are not adjacent:
$ uniq -u cities.txt Madrid Lisbon Madrid
Sort the file and count the number of identical lines:
$ sort cities.txt | uniq -c 1 Lisbon 2 Madrid
Assuming the following content for the file cities.txt:
madrid Madrid Lisbon
Show repeated lines ignoring case sensitiveness:
$ uniq -d -i cities.txt madrid
Same as above but showing the whole group of repeated lines:
$ uniq -D -i cities.txt madrid Madrid
Report the number of identical lines ignoring the first character of every line:
$ uniq -s 1 -c cities.txt 2 madrid 1 Lisbon
| UNIQ (1) | December 9, 2024 |
| Main index | Section 1 | 日本語 | Deutsch | Options |
Please direct any comments about this manual page service to Ben Bullock. Privacy policy.
| “ | An ASCII character walks into a bar and orders a double. "Having a bad day?" asks the barman. "Yeah, I have a parity error," replies the ASCII character. The barman says, "Yeah, I thought you looked a bit off." | ” |