Results 1 to 4 of 4
  1. #1
    brunoenrike is offline Member
    Join Date
    Mar 2013
    Posts
    2
    Rep Power
    0

    Default How Compare two text files and add the contents of one that does not exist in other?

    Hello I am new to Java (and novice) and needed as fast as possible to create a program that does this:
    Read two text files and compare them, what you do not have in the first and second java will add the contents

    missing on the second file,
    ex:

    ***********************************

    file1.txt

    I got to the park
    and then decided to kill time

    ***********************************

    file2.txt

    I Leaves home early
    I got to the park


    ***********************************


    Note that both have the phrase "I got to the park" but File2 has the phrase "and then decided to kill time," I want

    the Java
    Copy this entire line or more if you add in the File1 and File2 exactly right after the line that both have equal
    Thus File2 remained at the end as follows:

    ***********************

    file2.txt

    I Leaves home early <----------- This does not have the problem of not having File1 for who will be the final file

    will always be the last file in the case here File2.
    I got to the park <------ This sentence both files were then java should ignore it.
    and then decided to kill time <---- That sentence was in file1 not had in File2.

    ***********************

    Please if anyone knows how to do this program tell me it is urgent.

    *** The text files i have are too big for me to review these manually, would take too long.
    Always will be compared only two files. A have lines with phrases that the other lacks.

    To me this program is extremely difficult to do.

    Thank you.
    Last edited by brunoenrike; 03-14-2013 at 02:11 PM. Reason: is a question

  2. #2
    PhHein's Avatar
    PhHein is offline Senior Member
    Join Date
    Apr 2009
    Location
    Germany
    Posts
    1,430
    Rep Power
    7

    Default Re: How Compare two text files and add the contents of one that does not exist in oth

    What have you done so far? Nobody will do it for you. Post your code and ask specific questions to get help.
    Math problems? Call 1-800-[(10x)(13i)^2]-[sin(xy)/2.362x]
    The Ubiquitous Newbie Tips

  3. #3
    brunoenrike is offline Member
    Join Date
    Mar 2013
    Posts
    2
    Rep Power
    0

    Default Re: How Compare two text files and add the contents of one that does not exist in oth

    Quote Originally Posted by PhHein View Post
    What have you done so far? Nobody will do it for you. Post your code and ask specific questions to get help.

    I just want a hint, like where do I start, what classes should I use, as I said before I am a beginner with java.

    thanks for listening.

  4. #4
    PhHein's Avatar
    PhHein is offline Senior Member
    Join Date
    Apr 2009
    Location
    Germany
    Posts
    1,430
    Rep Power
    7

    Default Re: How Compare two text files and add the contents of one that does not exist in oth

    Scanner to read the files line by line. FileWriter to write the files.
    Math problems? Call 1-800-[(10x)(13i)^2]-[sin(xy)/2.362x]
    The Ubiquitous Newbie Tips

Similar Threads

  1. Replies: 6
    Last Post: 12-05-2011, 07:35 PM
  2. package sun.text.normalizer does not exist
    By jiayu in forum Advanced Java
    Replies: 3
    Last Post: 10-31-2011, 08:02 AM
  3. package java.text does not exist
    By sknn in forum NetBeans
    Replies: 12
    Last Post: 02-03-2010, 04:14 PM
  4. java.io.File - Files do not exist
    By TannerLD in forum New To Java
    Replies: 8
    Last Post: 09-10-2009, 01:03 AM
  5. Replies: 3
    Last Post: 11-03-2007, 02:58 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •