How to compare two lists and find the added and removed entries
By TechCompare · Updated · How we check
Put one entry per line and sort both lists the same way. Lines with a minus sign are only in the first list, and lines with a plus sign are only in the second.
The example
3 changes: 2 lines removed, 2 added
| Original: subscribers.txt | Changed: subscribers.txt | ||||
|---|---|---|---|---|---|
| 1 | ana@example.com | 1 | ana@example.com | ||
| 2 | Removed | ben@example.com | |||
| 3 | chloe@example.com | 2 | chloe@example.com | ||
| 4 | Removed | 3 | Added | Dev@example.com | |
| 5 | emma@example.com | 4 | emma@example.com | ||
| 5 | Added | farid@example.com | |||
Two exports of the same list rarely match. A mailing list gains and loses people, a product feed drops a SKU, a server list picks up a new host. Put one entry per line, paste each version on its own side, and the diff shows every entry that's only in one of the lists.
How this is calculated
The example compares two versions of a short subscriber list. As typed, the tool finds 3 changes: ben left, farid joined, and dev's address now starts with a capital letter. With Ignore case on, the result is 2 changes: 1 line removed, 1 added. The domain part of an email address ignores case, and most mail providers ignore it before the @ too, so the capital letter isn't a real change for this list.
Order matters in a line diff. The tool looks for the longest run of lines the two lists share in the same order, so a shuffled list shows changes even when it holds the same entries. Sort both lists before you compare them. On macOS or Linux, sort old.txt > old-sorted.txt does it, and spreadsheet apps can sort a column before you copy it.
Duplicates count too. If one list has the same entry twice, the extra copy shows as an added line. sort -u sorts and drops duplicates in one step.
For long lists on the command line, comm -3 old-sorted.txt new-sorted.txt prints only the entries that aren't in both files. It needs sorted input, the same way this tool needs sorted lists to give a clean result.
Verdict
Sort both lists, remove duplicates and then compare. The diff then reads like two short reports: minus lines are entries that left, plus lines are entries that joined. Turn on Ignore case for email addresses and hostnames, where capital letters don't change who or what an entry points to.
More Text Diff scenarios
Related guides
Frequently asked questions
How do I find entries that are in one list but not the other?
Why does the diff show changes for entries that are in both lists?
Does it ignore spaces at the end of a line?
Related tools
JSON Formatter
Validate, format, and minify JSON. Browse it as a tree, run JSONPath queries, compare two documents, or validate against a JSON Schema.
Use toolCharacter Counter
Count characters, words, sentences, paragraphs, and lines. Check writing limits and count specific characters or phrases.
Use toolText Encoding Converter
Convert text to Base64, binary, hex, URL encoding and HTML entities, and back again.
Use tool