Reputation: 21
i have 2 text files, file_1: and the other file2
file_1:
tango 12
beta 256
alpha 1700
tango 1200
file_2:
tango 12
tango 125 hello world
beta 256
alpha 1700
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. matches are exact string matches, both are text files. can any one tell me how can i do it using java
Upvotes: 2
Views: 2773
Reputation: 240870
Read both file in to Collection of String.
Then compare two List and process accordingly.
Rest all things are given by duffymo , Here is how to compare two arraylist of String
Upvotes: 1
Reputation: 308743
Break the problem into steps:
Upvotes: 4