Computing.Net > Forums > Programming > how to compare 2 files in java

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.

how to compare 2 files in java

Reply to Message Icon

Name: Arpita
Date: June 18, 2009 at 06:03:20 Pacific
OS: Windows XP
Subcategory: Java
Comment:

hello,

i have 2 text files, one is small (file_1: about 200 lines) and the other is fairly large (file2: 12 k - 20 k lines).

file_1:
tango 12
beta 256
alpha 1700
tango 1200

file_2:
tango 12
tango 125 hello world
beta 256
alpha 1700
Recent gama 5100 hi friend
Test charlie 502 hello dear
.......
....

I need to remove lines in file_2 which contains file_1 entries.
ie. read line by line from file_2, compare with file_1 lines, if match , remove , else append to a new file.
mathces are exact string matches, both are text files.


output_file:
test tango 125 hello world
Recent gama 5100 hi friend
Test charlie 502 hello dear
.......
....
please help me code for this problem in java.



Sponsored Link
Ads by Google
Reply to Message Icon

Related Posts

See More







Post Locked

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.


Go to Programming Forum Home


Sponsored links

Ads by Google


Results for: how to compare 2 files in java

How to compare 2 files using awk? www.computing.net/answers/programming/how-to-compare-2-files-using-awk/15598.html

How to compare 2 file date time stamps in bat www.computing.net/answers/programming/how-to-compare-2-file-date-time-stamps-in-bat/19411.html

How to combine 2 assembly files tog www.computing.net/answers/programming/how-to-combine-2-assembly-files-tog/10699.html