comm Linux Command Cheatsheet




comm Linux Command compare two sorted files line by line and write to output, It requires two sorted files which it compares line by line.

Syntax

comm [OPTION]... FILE1 FILE2

Options

OptionDescription
-1suppress printing of the first column (lines unique to the first file)
-2suppress printing of the second column (lines unique to the second file)
-3suppress printing of the third column (lines common to both the files)
–-check-ordercheck's the input is correctly sorted, even if all the input lines are pairable
–-nocheck-orderdo not check that the input is correctly sorted
–-output-delimiter=STRseparate columns with string STR

Example

$cat >file1.txt
one
two
three

$cat >file2.txt
one
three
four

$comm file1.txt file2.txt
		one
	three
	four
two
three


©Copyright 2020 OneCompiler | Privacy Policy | Terms & Conditions