List txt, remove the two duplicates

vinc -  
acefalo Posted messages 77 Status Membre -
Hello.

Sorry if I'm not in the right place.
I have a list of lines in a txt file and I would like to remove all duplicate lines without leaving any of the lines that were duplicated, for example.

A
B
B
C
D
D

I would like it to give

A
C

I don't have Excel and I had already used my trial version with my Windows, so I would like to do this with free software like Notepad++. If anyone knows how to do it, please.

Thank you.

6 réponses

acefalo Posted messages 77 Status Membre 19
 
Hello,

I can't test at the moment with Notepad ++ (I'm mainly on Linux), but I found this (Don't forget to work with a copy of the file):

You select the lines and in the Edit menu
Edit->Line Operations->Sort Lines Lexicographically Ascending
Edit->Line Operations->Remove Consecutive Duplicate Lines

I will give you an example using LibreOffice Calc, a free and open-source software. The process is longer, but I tested it and it works.

You start by copying your lines into column A.

In cell B1, you copy the following formula:
=COUNTIF(A:A,A1)
. Then you drag the small black square at the bottom right of cell B1 all the way down. You will get the following result:

A 1
B 2
B 2
C 1
D 2
D 2

Then you click at the top of column A (to select it entirely) and then move to the right (keeping the left mouse button pressed) to also select column B entirely.
Next, you go to the menu.
Data/More Filters/Standard Filter

Field name: column B
Condition: =
Value: 1

You expand the Options menu.
You check the box Copy results to: D1
You click on Validate.

You will have the following result:
A 1
C 1

You can copy the unique column.
1