aspose file tools*
The moose likes Java in General and the fly likes How to replace a word in a file with another. Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "How to replace a word in a file with another." Watch "How to replace a word in a file with another." New topic
Author

How to replace a word in a file with another.

pradeep kumar rama
Greenhorn

Joined: Apr 26, 2007
Posts: 3
Hi, can anyone tell me the code to replace a word in a file with another. Eg. The code should be able to replace all the occurences of the word "java" ina file to "j2ee".
Balasubramanian Chandrasekaran
Ranch Hand

Joined: Nov 28, 2007
Posts: 215

Hi Pradeep,
...the code to replace a word in a file with another...


May be you can try this link

Text Replacement
pradeep kumar rama
Greenhorn

Joined: Apr 26, 2007
Posts: 3
Hi Chandra. The url you sent me solved my problem. Many Thanks for your reply. Also can we have any means by which we can do it without using the replaceAll or any other inbuilt function ?
 
Consider Paul's rocket mass heater.
 
subject: How to replace a word in a file with another.