my dog learned polymorphism*
The moose likes Beginning Java and the fly likes Help need in reading and writing to a file Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Help need in reading and writing to a file" Watch "Help need in reading and writing to a file" New topic
Author

Help need in reading and writing to a file

Rashid Rupani
Greenhorn

Joined: Aug 20, 2004
Posts: 1
How to extract data from txt files and write into another txt file in a predefined format


Example
1- Read data between "|-" and "-|"
xxxxxxx|-product a-|xxxxxxxx|- prodcut b-|xxxxx|- product c -| xxxxxx |- product d -|

2- And now write in txt file in a format defined below
product a | prodcut b | product c |

Can anyone provide me source code for this. This will help me alot.
Looking for a positive answer.
Francis Siu
Ranch Hand

Joined: Jan 04, 2003
Posts: 867
hi Rashid Rupani
welcome
You may be better to do it by yourself and post any problem you may have. You can post your programming structure here if you want to improve your programming skill and learn something that you can remember by heart.
Nothing you can get if I give you an answer.


Francis Siu
SCJP, MCDBA
omar bili
Ranch Hand

Joined: Aug 13, 2004
Posts: 177
Rahid ,you can use the FileReader and the FileWriter
to read and write Data
you can use the readLine() method
and store the Line that you have read in a String
and you can get the data from that String
if u need some help on how to use the FileWriter or
FileReader just tell me.
Dirk Schreckmann
Sheriff

Joined: Dec 10, 2001
Posts: 7023
Welcome to JavaRanch, Rashid!

Many folks 'round here will be glad to offer advice, hints and nudges in the right direction towards you're better learning Java programming.

What have you got so far? Is something particular not clear to you? Are you getting any error messages at compile time or at run time? What are they?

When posting code, please be sure to surround the code with the [code] and [/code] UBB Tags. This will help to preserve the formatting of the code, thus making it easier to read and understand.


[How To Ask Good Questions] [JavaRanch FAQ Wiki] [JavaRanch Radio]
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Help need in reading and writing to a file
 
Similar Threads
Meta Stock data ?? Anyone?
Reading BLOB data in DB2 SQL Stored Procedure
Meta Stock data ?? Anyone?
URLyBird Database file query
how to include file-separator in fileName?