Skip to content

Uniq

Report or filter out repeated lines in a file.

주의사항

정렬이 되었다는 전제로 사용해야 한다.

Options

-c
Precede each output line with the count of the number of times the line occurred in the input, followed by a single space.
-d
Only output lines that are repeated in the input.
-u
Only output lines that are not repeated in the input.
-f num
Ignore the first num fields in each input line when doing comparisons.
-i
Case insensitive comparison of lines.
-s chars
Ignore the first chars characters in each input line when doing comparisons.

Examples

sort yourfile.txt | uniq -d
중복되는 라인만 출력
sort yourfile.txt | uniq -u
중복되지 않는 라인만 출력

See also