how to find duplicate text exist in shared path .txt file

anandbe22

Member
Joined
Jan 3, 2023
Messages
5
Programming Experience
10+
Hello All,

Need your help on , how to find duplicate text in .txt file placed in shared path.

Example let if text last 4000 record text as "anand" and 40001 record also contains "anand" I need total count of duplicate records count exist in this .txt file using C#.net .

total records 54 lakhs records exist in .txt file but for each record any performance issue comes please suggest any other example.
 
You basically have no choice but to read the whole file. If you want performance then use a database rather than text files. You can use the Jet OLE DB provider to read the file and then treat it like a database, i.e. use SQL to query it, but it's still going to read the whole file. The alternative would be to read the file yourself and then manipulate the data in your own C# code. It's up to you to decide which way you want to go and then ask us for help with a specific issue if one arises.
 
We aren't necessarily a code writing service, but ChatGPT can be :)


1672744932761.png


1672745076463.png



You can even have an enduring conversation with it, and ask it to make adjustments:

1672745157523.png


I didn't even tell it why I asked for that improvement, but it surmised anyway:

1672745233668.png



And yes, I know that I've posted code as screenshots but I did so specifically to encourage you to make an openai account and try the bot out for yourself.. There is a "copy code" button at the top of each block it generates, to make it easy for you to take its suggestion and improve it

---

Second tip; "lakh" and "crore" aren't commnly used in counting outside of india. You'd be better off using the more typical "groups of three" like thousands, millions, billions or if in any doubt, just the entire number, like 5,400,000 instead of 54 lakhs - after all, using lakhs only saves you one character
 
Last edited:
Back
Top Bottom