| Author |
Comparing lines in a text file.
|
Rodrigo Aguilera
Greenhorn
Joined: Dec 20, 2004
Posts: 3
|
|
Hi, i am learning Java and i need to make a little program that gets a text file and search for duplicate lines in it. The lines in the text file look like this : 2004-12-19 00:00:00.000,105,19:57:26,INI,DISCANDO INTRANET 2004-12-19 00:00:00.000,105,19:57:26,INI,DISCANDO INTRANET Maybe there is a method to make this work. thanks in advance.
|
 |
Stan James
(instanceof Sidekick)
Ranch Hand
Joined: Jan 29, 2003
Posts: 8791
|
|
Do you want to display duplicates or eliminate them? I started out thinking eliminate, but it's hard to tell from your question. If duplicates appear next to each other, something like this will copy a file and remove duplicate lines: If duplicates could appear anywhere, look into the Collections APIs to find one that doesn't store duplicates or one you could ask if a line already exists. Here's my Collections Crib Sheet that may help. Let us know what you choose! [ December 20, 2004: Message edited by: Stan James ]
|
A good question is never answered. It is not a bolt to be tightened into place but a seed to be planted and to bear more seed toward the hope of greening the landscape of the idea. John Ciardi
|
 |
Rodrigo Aguilera
Greenhorn
Joined: Dec 20, 2004
Posts: 3
|
|
Thanks for the tip. I would like to remove the duplicated lines. I will let you know when i finish it. thanks.
|
 |
 |
|
|
subject: Comparing lines in a text file.
|
|
|