• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 168
  • Last Modified:

Java program to read unique records from a file

I have a file which about a GB, its from a SQL output which has dups in it.(abc.txt)
I am trying to wrtie a program which could read abc.txt and write the unique records to def.txt
How can I do this in java.

Thanks
0
mkhan900
Asked:
mkhan900
  • 3
1 Solution
 
krakatoaCommented:
Recipe: 1 boolean for uniqueness, 2 nested for loops, iterate the list, each element against all others, if unique at the end of outer loop, write it to new file, if not, move to next in outer loop.
0
 
krakatoaCommented:
Ow, that's for unique values, you want de-duping.
0
 
krakatoaCommented:
Thanks. It should work for dupes though too. ;)
0

Featured Post

Never miss a deadline with monday.com

The revolutionary project management tool is here!   Plan visually with a single glance and make sure your projects get done.

  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now