This week's book giveaway is in the Mac OS forum.
We're giving away four copies of a choice of "Take Control of Upgrading to Yosemite" or "Take Control of Automating Your Mac" and have Joe Kissell on-line!
See this thread for details.
The moose likes I/O and Streams and the fly likes Erase a line in a file and insert a new line onn that line. Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Java » I/O and Streams
Bookmark "Erase a line in a file and insert a new line onn that line." Watch "Erase a line in a file and insert a new line onn that line." New topic
Author

Erase a line in a file and insert a new line onn that line.

Minseong Kim
Greenhorn

Joined: Jun 28, 2010
Posts: 5
hi.

how can I search and erase a line in a file by using Java codes?

for example, if have README,

and I want to erase line 23 and insert new information, how am I able to do this using Java codes?

Thanks.
Tom Reilly
Rancher

Joined: Jun 01, 2010
Posts: 618
See this FAQ: Edit An Existing File http://faq.javaranch.com/java/EditAnExistingFile

Also see this post that points to the Java classes that you will use: http://www.coderanch.com/t/279094/Streams/java/Delete-line-text-file#1283566
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Erase a line in a file and insert a new line onn that line.