
Why some copies are not found
Two lines only count as copies when every character matches. A space at the end of a line is invisible, and "Milk" and "milk" differ in one letter. Text from a web page often has a no-break space instead of a normal one. Some sites add a zero width space that does not show at all.
The letter é can be stored two ways: as one character, or as e plus an accent mark. Tick "Invisible characters" and the tool treats both forms as one letter. It also skips zero width characters and reads odd spaces as normal spaces. Line ends from Windows (CRLF) and from Linux or Mac (LF) are read the same way.
When a looser setting would find more copies, the note under the result says how many. To see which hidden characters a line holds, paste it into the invisible character tool. To clean the text itself, use the text cleaner.
Duplicates in one column of a CSV file
Rows of a CSV file can differ in one value and still be the same person or product. Open More options, set Compare to "one column" and give its number. The whole row stays or goes. Tick "Keep the first line on top" so the row of column names is left alone.
This is where "Last copy" helps. Say people signed up twice with the same email address. The last row may hold their new city, so "Last copy" keeps the newest row in its place. The tool finds the separator by itself: a tab, a comma, a semicolon or a bar. For a grid view of the whole table, open the CSV editor.
Remove duplicates in Excel and Google Sheets
In Excel, select the column, then go to Data, Data Tools, Remove Duplicates. Pick the columns to compare and click OK. Excel keeps the first copy and deletes the other rows.
In our test with Excel for Microsoft 365, Remove Duplicates and the UNIQUE function both ignored case, so "Apple" and "apple" were one value. A space at the end still made a value different. Excel also compares what a cell shows, so one date in two formats counts as two values. Microsoft's guide to removing duplicate values has the details.
In Google Sheets, select the data and go to Data, Data cleanup, Remove duplicates. Cells that differ only in letter case still count as copies there. To also catch copies that differ only in spaces, run Data cleanup, Trim whitespace first.
Notepad++, VS Code and Word
Notepad++ has Edit, Line Operations, Remove Duplicate Lines. It keeps the first copy of each line. Remove Consecutive Duplicate Lines only removes a copy that sits right below the line it repeats.
In VS Code, press Ctrl+Shift+P and run "Delete Duplicate Lines". It keeps the first copy and compares lines exactly, so case and spaces count.
Word has no command for this. Home, Sort puts the paragraphs in order, so copies end up next to each other and you can delete them by hand. For a long list, paste it here and paste the result back into Word.
Remove duplicate lines on the command line
On Linux and macOS, sort -u sorts the lines and keeps one of each. uniq only merges copies that sit right next to each other, so people sort first. Both lose the order of the list. The awk line keeps the order, because it prints a line only the first time it sees it.
| Command | What it does |
|---|---|
| sort -u file.txt | Sorts and keeps one copy of each line |
| sort -f -u file.txt | The same, but Apple and apple are one line |
| awk '!seen[$0]++' file.txt | Keeps the first copy, in the original order |
| tac file.txt | awk '!seen[$0]++' | tac | Keeps the last copy, in the original order. macOS has no tac, so use tail -r there. |
| sort file.txt | uniq -c | Counts how often each line appears |
| sort file.txt | uniq -d | Shows only repeated lines, once each |
| sort file.txt | uniq -u | Shows only lines with no copy |
| Get-Content file.txt | Select-Object -Unique | PowerShell: keeps the first copy in order, case matters |
| Get-Content file.txt | Sort-Object -Unique | PowerShell: sorts and ignores case |
A file saved on Windows has a carriage return at the end of each line. sort and uniq then see "apple" with and without it as two lines, so convert the line ends first. The uniq manual lists more options. Checked with GNU coreutils 8.32 and Windows PowerShell 5.1, November 2026.