-
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.
-
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?
-
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 03:13 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.
Similar Threads
-
By LordNightwinter in forum VB Classic
Replies: 1
Last Post: 09-06-2006, 03:15 PM
-
By trains58554 in forum .NET
Replies: 2
Last Post: 08-24-2006, 01:03 AM
-
By neerajks in forum .NET
Replies: 0
Last Post: 04-26-2006, 06:19 AM
-
Replies: 2
Last Post: 02-28-2002, 10:53 AM
-
Replies: 6
Last Post: 07-27-2001, 12: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
Forum Rules
|
Top DevX Stories
Easy Web Services with SQL Server 2005 HTTP Endpoints
JavaOne 2005: Java Platform Roadmap Focuses on Ease of Development, Sun Focuses on the "Free" in F.O.S.S.
Wed Yourself to UML with the Power of Associations
Microsoft to Add AJAX Capabilities to ASP.NET
IBM's Cloudscape Versus MySQL
|
Bookmarks