Skip to content
TypeParser
All tools

Dedupe Lines

Remove duplicate lines.

beats textmechanic.com edge: First/last/unique modes + case toggle
input
Guide

About Dedupe Lines

Remove duplicate lines from any text. Choose to keep the first occurrence, keep the last, or keep only lines that appear exactly once (unique-only). Optional case-insensitive matching, trim whitespace before comparing. Useful when cleaning up exports, email lists, log lines, or feature flags.

Common cleaning patterns

The most common batch cleaning tasks:

  • Email list dedup — vendor exports often duplicate addresses; one address, one row.
  • Log line dedup — kill repeated identical errors before grepping.
  • Feature flag list cleanup — multiple environments contributed; consolidate.
  • Vocabulary list dedup — for language learning sets, dictionaries.
  • CSV row dedup — when you want unique rows; combine with Sort Lines.

Modes in detail

  • Keep first — input order preserved, first occurrence wins.
  • Keep last — input order preserved, last occurrence wins. Useful when later entries override earlier (config files).
  • Unique only — drop everything that appeared more than once. Useful for finding singletons.
  • Show duplicates only — inverse of unique only; surfaces only the lines that recurred.

Common workflows

Clean an email list. Paste, dedupe, optionally lowercase first via Case Converter so Email@x.com and email@x.com collapse.

Find log fingerprints. Replace timestamps with placeholders, dedupe, count remaining lines — surfaces repeated error patterns.

Spot duplicates. Switch to “Show duplicates only” to find which lines are repeated; useful when auditing.

Frequently asked questions

First, last, or unique?
First keeps the first appearance, drops later duplicates. Last drops earlier copies, keeps the last. Unique drops every line that appeared more than once.
How does case insensitivity work?
Toggle case-insensitive — comparison is case-folded so foo and Foo are duplicates. The kept line preserves original case.
Trim whitespace?
Toggle to ignore leading and trailing whitespace when comparing. Useful when copy-pasted data has inconsistent indentation.
Order preservation?
Original order is kept (modulo the lines being removed). For sorted output, follow with Sort Lines.
Performance?
Up to ~1,000,000 lines comfortably. Above that, prefer sort -u at the shell.
Empty lines?
Counted as lines, dedup'd accordingly. Toggle Strip empty to drop them entirely.

Related tools

Last updated: 2025-01-15