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.
06-18-2009, 11:30 PM
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?
06-20-2009, 03:07 AM
String text; // read the text from the file in a string variable
i = text.indexOf("s")
06-20-2009, 09:51 AM
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.