uniq, comm Examples

uniq, comm Examples

uniq - report or omit repeated lines


-c: prefix lines by the number of occurrences
-d: print duplicate lines, one for each group
-i: ignore differences in case when comparing
-f <num>: avoid comparing the first <num> fields
-s: avoid comparing the first N characters
-u: only print unique lines


comm - compare two sorted files line by line

comm [OPTION]... FILE1 FILE2

When FILE1 or FILE2 (not both) is -, read standard input.

-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)
for further information see the manual page uniq(1), manual page comm(1)

all examples assembled by andreas schmidt for the IC3K 2022 conference