Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

uniq

v(uutils coreutils) 0.8.0
uniq [OPTION]... [ENTRÉE [SORTIE]]

Signaler ou omettre les lignes répétées.

Options

--all-repeated=<delimit-method>, -D <delimit-method>

afficher toutes les lignes dupliquées. La délimitation se fait avec des lignes vides. [défaut : none]

--group=<group-method>

afficher tous les éléments, en séparant les groupes avec une ligne vide. [défaut : separate]

--check-chars=<N>, -w <N>

comparer au maximum N caractères dans les lignes

--count, -c

préfixer les lignes par le nombre d’occurrences

--ignore-case, -i

ignorer les différences de casse lors de la comparaison

--repeated, -d

afficher seulement les lignes dupliquées

--skip-chars=<N>, -s <N>

éviter de comparer les N premiers caractères

--skip-fields=<N>, -f <N>

éviter de comparer les N premiers champs

--unique, -u

afficher seulement les lignes uniques

--zero-terminated, -z

terminer les lignes avec un octet 0, pas une nouvelle ligne

Filtrer les lignes adjacentes correspondantes de ENTRÉE (ou l’entrée standard), en écrivant vers SORTIE (ou la sortie standard).

Note : uniq ne détecte les lignes répétées que si elles sont adjacentes. Vous pourriez vouloir trier l’entrée d’abord, ou utiliser sort -u sans uniq.

Examples

The examples have not been translated yet and are shown in English. You can help by translating them on tldr-pages.

Display each line once:

sort {{path/to/file}} | uniq

Display only unique lines:

sort {{path/to/file}} | uniq {{[-u|--unique]}}

Display only duplicate lines:

sort {{path/to/file}} | uniq {{[-d|--repeated]}}

Display number of occurrences of each line along with that line:

sort {{path/to/file}} | uniq {{[-c|--count]}}

Display number of occurrences of each line, sorted by the most frequent:

sort {{path/to/file}} | uniq {{[-c|--count]}} | sort {{[-nr|--numeric-sort --reverse]}}

Compare only the first 10 characters on each line for uniqueness:

sort {{path/to/file}} | uniq {{[-w|--check-chars]}} 10

Compare text after the first 5 characters on each line for uniqueness:

sort {{path/to/file}} | uniq {{[-s|--skip-chars]}} 5

The examples are provided by the tldr-pages project under the CC BY 4.0 License.

Please note that, as uutils is a work in progress, some examples might fail.