Find Duplicate Lines

Find repeated lines and show how many times each exact line occurs. This is a review tool: it reports duplicates without changing your source text.

What this tool actually changes

The tool counts each exact input line with a JavaScript Map, then reports only entries whose count is greater than one. Results retain the order in which each distinct line was first encountered.

Edge cases to know

Comparison is exact and case-sensitive. Whitespace is significant, so alpha and alpha with a leading space are different lines. Blank lines are counted too if they occur more than once.

Example

Input:
alpha
beta
alpha
gamma
beta

Output:
alpha (2)
beta (2)

Good use cases

Checking exported data, repeated identifiers, copied configuration, lists, and logs before deciding whether duplicates should be removed.

Review before you remove

Use this as an inspection step when repetition may be meaningful. For logs, check timestamps and context around repeated messages before changing anything. For a list of identifiers, compare the exact displayed spelling with the rules of the system that will consume it.

How to interpret the report

Counts are total occurrences, not “extra copies”: a line shown as alpha (3) appeared three times. The report lists each duplicated line once, ordered by its first appearance. A repeated blank line is rendered as a leading space before its count.

Complexity and practical limit

The tool counts lines in one pass using a map, so its work and memory grow with the number and total size of the input lines. For very large logs, use local tools that can stream from a file instead of pasting the entire file into a browser.

Frequently asked questions

Does it remove duplicates?

No. It reports repeated lines and their counts without modifying the input.

Are counts case-sensitive?

Yes. Lines are compared exactly, including capitalization and whitespace.

Can it find repeated blank lines?

Yes. Blank lines are ordinary input lines and are counted if they repeat.

Are the counts extra copies or total occurrences?

They are total occurrences. A line printed with a count of 3 appeared three times in the input.

Advertisements