Coalescing Text Files


DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 4 of 4

Thread: Coalescing Text Files

Hybrid View

  1. #1
    Join Date
    Jun 2009
    Posts
    1

    Coalescing Text Files

    Hi everyone! I am not a big programmer, but unfortunately have run into a problem with a lot of output. Any help, or how I can structure the program...well, really anything would be helpful. Here is the problem issue:

    I am interested in taking strings out of the text files that end in ing.txt in a specific folder. There are other extraneous text files in this folder, but I am only interested in the aforementioned ones. Inside the folder, I want to take the strings out and place them into a new text document. Unfortunately, it gets more complicated : (. Inside these text files, the strings I need to pull out are not separated by columns, lines, or even spaces. However, all the new strings start with an s followed by numbers (For instance s99999s88888 should be sepereated into "s99999" and "s88888"). How can I take these strings from the different text files and write them into a new consolidated text file (preferably list format but anything works). I know some Java, but am not utterly proficient. Any help would be greatly appreciated; figuring out some kind of code would be so much better than going through 9,000 files. Thanks in advanced for any help.

  2. #2
    Join Date
    Dec 2004
    Location
    San Bernardino County, California
    Posts
    1,468
    if you can make it work for one file, you can make it work for 9000 files.

    Be systematic in your approach. What are your steps?

  3. #3
    Join Date
    Apr 2008
    Location
    Finland
    Posts
    52
    if(filename.endsWith("ing.txt"))

    ...

    String text; // read the text from the file in a string variable
    int i;
    i = text.indexOf("s")

    ...
    Last edited by sypress; 06-20-2009 at 04:13 AM.

  4. #4
    Join Date
    Dec 2004
    Location
    San Bernardino County, California
    Posts
    1,468
    there are various file readers in the i/o packages, and the Scanner class in java.util will tokenize the stream from the file so that you can process it. There is little need for hand coding that portion of the task. THe most important lesson from this assignment is to learn that once you know how to handle files as objects, then open one and process it, and then how to move on to the next file until you are done,you can process 9000 or more such files.

Similar Threads

  1. Randomized Results from multiple text files
    By LordNightwinter in forum VB Classic
    Replies: 1
    Last Post: 09-06-2006, 04:15 PM
  2. search text files
    By trains58554 in forum .NET
    Replies: 2
    Last Post: 08-24-2006, 02:03 AM
  3. Text Search within Word and Acrobat Files
    By neerajks in forum .NET
    Replies: 0
    Last Post: 04-26-2006, 07:19 AM
  4. Replies: 2
    Last Post: 02-28-2002, 11:53 AM
  5. reading multiple text files
    By simon in forum XML
    Replies: 6
    Last Post: 07-27-2001, 01: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
  •  
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center