'uniq' - print or omit repeated lines - Video Man Pages

'uniq' - print or omit repeated lines - Video Man Pages

D
DistroTube
1 Video View·Oct 4, 2025

The 'uniq' command is used to print or omit repeated lines of text.

- Display each line once (duplicate lines printed only once):
sort path/to/file | uniq

- Display only unique lines (duplicate lines not printed at all):
sort path/to/file | uniq -u

- Display only duplicate lines (duplicate lines printed only once):
sort path/to/file | uniq -d

- Display only duplicate line and count number of occurrences of each line:
sort path/to/file | uniq -cd

- Compare no more than 5 characters in lines:
sort path/to/file | uniq -w 5

- Avoid comparing the first 5 characters in lines:
sort path/to/file | uniq -s 5

REFERENCED:
https://gitlab.com/dwt1/vidman

WANT TO SUPPORT THE CHANNEL?
💰 Patreon: https://www.patreon.com/distrotube
💳 Paypal: https://www.paypal.com/donate/?hosted_button_id=MW3ZFGS8Q9JGW
🛍️ Amazon: https://amzn.to/2RotFFi
👕 Teespring: https://teespring.com/stores/distrotube

DT ON THE WEB:
🕸️ Website: http://distro.tube
📁 GitLab: https://gitlab.com/dwt1
🗨️ Mastodon: https://fosstodon.org/@distrotube
👫 Reddit: https://www.reddit.com/r/DistroTube/
📽️ Odysee: https://odysee.com/@DistroTube:2

FREE AND OPEN SOURCE SOFTWARE THAT I LIKE:
🌐 Brave Browser - https://brave.com/
📽️ Open Broadcaster Software: https://obsproject.com/
🎬 Kdenlive: https://kdenlive.org
🎨 GIMP: https://www.gimp.org/
💻 VirtualBox: https://www.virtualbox.org/
🗒️ Doom Emacs: https://github.com/hlissner/doom-emacs

Your support is very much appreciated. Thanks, guys!