Please tell me how to compare 2 text files

Please provide me the code how to compare two file . Suppose there are 3 file.We compare file1 with file2 line by line(Row wise). Suppose i compare logonid(unique) of file1 with file2. If logonid is match then copy the entire row to file3. Please tell me the what is the code for it.

[290 byte] By [minatia] at [2007-11-27 11:46:32]
# 1

Suppose you write the code yourself.

floundera at 2007-7-29 18:08:07 > top of Java-index,Java Essentials,Java Programming...
# 2

Better get a fire extinguisher ready. You are going to get flamed.

sabre150a at 2007-7-29 18:08:07 > top of Java-index,Java Essentials,Java Programming...
# 3

cross post

http://forum.java.sun.com/thread.jspa?threadID=5199183

TuringPesta at 2007-7-29 18:08:07 > top of Java-index,Java Essentials,Java Programming...
# 4

Wow, so minati is both lazy and inconsiderate. Nice.

jverda at 2007-7-29 18:08:07 > top of Java-index,Java Essentials,Java Programming...
# 5

ouch

pberardi1a at 2007-7-29 18:08:07 > top of Java-index,Java Essentials,Java Programming...
# 6

use FileInputStream to read files . u might have heard about readLine.

once that is done use equalsIgnoeCase method to compair lines from both files .. if equals then u do u r further processing ..

Now use this logic in u r code ..

AmitChalwade123456a at 2007-7-29 18:08:07 > top of Java-index,Java Essentials,Java Programming...