How to remove unique values from text file and get only duplicate value list?

How to remove unique values from text file and get only duplicate value list?

@vidya.wagh ,
Can you provide us the input file if possible?

New Text Document.txt (441 Bytes)

Hey @vidya.wagh

image

Is this what you want

image

image

Regards,

Hi @vidya.wagh

You can use the following approach:

Flow:

Query:

(From row In textDataTable.AsEnumerable()
Select name = row(0).ToString().Trim()
Distinct).ToArray()

Output:

image

Hope this helps,
Best Regards.

1 Like

One of many options:

getting the duplicates:
grafik

getting the non duplicates:
grafik

In Addition to above, getting all duplicated values but only 1 time:

Also have a look at this report dict:

thanks for your response. even I have got this output but what i want is to delete unique values also.

your 1st image is what i want. can you share me the workflow please.

was done in immediate panel
Understanding the 6 Debugging Panels of UiPath in the easiest way possible! - News / Tutorials - UiPath Community Forum

Assign Activity:
myFilePath = YourFullFilepathTo The TextFile

Assign Activity:
arrDups | String Array =

File.ReadAllLines(myFilePath).GroupBy(Function (x) x).Where(Function (g) g.count > 1).SelectMany(Function (v) v).toarray

can you please elaborate it more and write all the records in the text file.

grafik

Variable:
grafik
grafik

Writing back to a file:
grafik
String.Join(Environment.NewLine, arrDups)

“String.Join(Environment.NewLine, arrDups)” this is writing all the records. only want duplicate list with single record.

then use other statement

File.ReadAllLines(myFilePath).GroupBy(Function (x) x).Where(Function (g) g.count > 1).SelectMany(Function (v) v).Distinct().toarray
1 Like

Thank you so much for help.

can i apply same logic for 10-100 million records? because it not giving me correct result.

I recently stumbled upon DuplicateFilesDeleter and it’s been a game-changer for me. It’s incredibly user-friendly and does the job it promises to do. If you’re tired of sifting through duplicate files on your computer, this program is definitely worth checking out.

If you’re looking for a reliable way to clean up your computer and free up space, I highly recommend DuplicateFilesDeleter. It’s a powerful program that quickly identifies and deletes duplicate files, saving you time and hassle. Try it out today and see for yourself how much easier it makes managing your digital files.

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.