How this tool works
Each line is reduced to a comparison key and the keys are tracked as the list is walked. A line whose key has been seen before is a duplicate. The key is what the options change: trimming ignores leading and trailing spaces, and ignoring case folds everything to lower case before comparing. The line that is kept is always written out exactly as you typed it — the options decide what counts as the same, never what the output looks like.
Keeping the first occurrence preserves your original order. Keeping the last moves each surviving line down to the position of its final appearance, which matters when the later copy is the corrected one. Sorting alphabetically, if you ask for it, happens after de-duplication and uses locale-aware comparison, so accented characters land where a reader of that language would expect rather than after Z.
Details that explain a surprising count
- Comparison is whole-line: two lines that differ by a single trailing space are different lines unless trimming is on. This is the usual reason a list that looks de-duplicated still has pairs in it.
- Dropped blank lines are counted as removed: the removed figure is the difference between the lines you pasted and the lines you got back, so discarding empty lines inflates it beyond the number of true duplicates.
- Keeping the last occurrence changes positions: the earlier copy disappears and the survivor stays where the last one was. Choose it when a list has been appended to and the newest entry wins.
- Sorting is optional and applied last: leave it off and the surviving lines stay in the order you pasted them, which is what you want for logs and anything chronological.