NAME
uniq - report or omit repeated lines
SYNOPSIS
uniq [OPTION]... [INPUT [OUTPUT]]
DESCRIPTION
Filter adjacent matching lines from INPUT
(or standard input), writing to OUTPUT (or standard output).
With no options, matching lines are merged to the first occurrence.
Mandatory arguments to long options are mandatory for short options too.
-c,
--count
prefix lines by the number of occurrences
-d,
--repeated
only print duplicate lines
-D,
--all-repeated[=delimit-method]
print all duplicate
lines delimit-method={none(default),prepend,separate} Delimiting is done
with blank lines.
-u,
--unique
only print unique lines
================================================================================
e.g.1
[root@localhost tmp]# cat num.txt
111
111
667
999
111
/*此处与L1 L2不相邻 不作为重复统计*/
[root@localhost tmp]# uniq -d num.txt
111
[root@localhost tmp]# uniq -D num.txt
111
111
[root@localhost tmp]# uniq -c num.txt
2 111
1 667
1 999
1 111