The uniq command in Unix/Linux is a utility that is used to filter out adjacent, duplicate lines from a sorted file. It is often used in conjunction with the sort command, as uniq operates on adjacent lines, identifying and removing duplicates that appear consecutively.
Here are some common options: -c or --count: Prefix lines by the number of occurrences. -d or --repeated: Only print duplicate lines. -i or --ignore-case: Ignore differences in case when comparing lines. -u or --unique: Only print unique lines. -f N or --skip-fields=N: Avoid comparing the first N fields. -s N or --skip-chars=N: Avoid comparing the first N characters.
sort filename | uniq
sort filename | uniq -c
sort filename | uniq -i
sort filename | uniq -d
sort filename | uniq -dc
sort filename | uniq -w4
sort filename | uniq -c -w4
sort filename | uniq -ci
sort filename | uniq -c -s2
sort -t',' filename.csv | uniq -c -s2
sort filename | uniq -ci -s3
sort -t',' filename.csv | uniq -ci -s2
sort filename | uniq -c -s+2
sort -t',' filename.csv | uniq -c -s+2
sort filename | uniq -ci -s+2
sort -t',' filename.csv | uniq -ci -s+2
sort filename | uniq -c -s-2
sort -t',' filename.csv | uniq -c -s-2
sort filename | uniq -ci -s-2
sort -t',' filename.csv | uniq -ci -s-2
sort filename | uniq -c -w2
sort -t',' filename.csv | uniq -c -w2
sort filename | uniq -c -w+2
sort -t',' filename.csv | uniq -c -w+2
sort filename | uniq -c -w-2
sort -t',' filename.csv | uniq -c -w-2
sort filename | uniq -ci -w2
sort -t',' filename.csv | uniq -ci -w2
sort filename | uniq -ci -w+2
sort -t',' filename.csv | uniq -ci -w+2