uniq Command Generator
Generate uniq commands to report or omit repeated lines
Getting Started with uniq
## What is uniq?
`uniq` filters out (or reports) adjacent repeated lines. **Only consecutive duplicates are collapsed** — sort the input first if you want all duplicates handled.
## How to Use
1. **Set Options** (optional): count, only-duplicates, only-unique, ignore case. 2. **Specify File**: Enter the input file. 3. **Copy & Run**: Copy the generated command into your terminal.
A typical pipeline is `sort file.txt | uniq`.
Common Modes
### `-c` Count Prefix each output line with the number of times it occurred consecutively.
### `-d` Only duplicates Print only one copy of lines that repeat (drop singletons). Pair with `-c` to see counts.
### `-u` Only unique Print only lines that are never repeated.
### `-i` Ignore case Treat differences in case as equality when comparing.
### Pipeline pattern Because `uniq` only collapses adjacent matches, combine it with `sort`:
``` sort items.txt | uniq -c | sort -rn ```
This counts occurrences and lists the most frequent first.
▶Why are some duplicate lines not removed?
▶How do I get a frequency count?
If this tool has been helpful to you, consider buying me a coffee.
Buy me a coffee