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

comm

v0.13.0
comm [OPTION]... FICHIER1 FICHIER2

Comparer deux fichiers triés ligne par ligne.

Lorsque FICHIER1 ou FICHIER2 (pas les deux) est -, lire l’entrée standard.

Sans options, produit une sortie à trois colonnes. La colonne un contient les lignes uniques à FICHIER1, la colonne deux contient les lignes uniques à FICHIER2, et la colonne trois contient les lignes communes aux deux fichiers.

Options

-1

suppress column 1 (lines unique to FILE1)

-2

suppress column 2 (lines unique to FILE2)

-3

suppress column 3 (lines that appear in both files)

--output-delimiter=<STR>

separate columns with STR

--zero-terminated, -z

line delimiter is NUL, not newline

--total

output a summary

--check-order

check that the input is correctly sorted, even if all input lines are pairable

--nocheck-order

do not check that the input is correctly sorted

Examples

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

Produce three tab-separated columns: lines only in first file, lines only in second file, and common lines:

comm {{file1}} {{file2}}

Print only lines common to both files:

comm -12 {{file1}} {{file2}}

Print only lines common to both files, reading one file from stdin:

cat {{file1}} | comm -12 - {{file2}}

Get lines only found in first file, saving the result to a third file:

comm -23 {{file1}} {{file2}} >{{file1_only}}

Print lines only found in second file, when the files aren’t sorted:

comm -13 <(sort {{file1}}) <(sort {{file2}})

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.