This week's book giveaways are in the Refactoring and Agile forums.
We're giving away four copies each of Re-engineering Legacy Software and Docker in Action and have the authors on-line!
See this thread and this one for details.
Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

how to delete or modify the data in file.(not the total file)

 
shiva ram kumar
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi 2 all....
I m new to java .
how to edit the data or delete the data in the files

please reply ..
 
Siva Masilamani
Ranch Hand
Posts: 385
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Read the data from the file and do whatever you want like adding,editing or deleting the data then write it to the same file.

This could be done by using java.io package.
 
shiva ram kumar
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Siva Masilamani wrote:Read the data from the file and do whatever you want like adding,editing or deleting the data then write it to the same file.

This could be done by using java.io package.

thanks for the reply ..

i have the outputfile.txt
shiva,20,good
raju,10,good
ramesh,20,bad

i have to modify the data shiva ,20,good to shiva ,40,bad.
I dont want the whole file to be rewirtten . only the data which i modified has to be changed.

My desire output.txt
shiva,40,bad
raju,10,good
ramesh,20,bad.

Note: the whole file should not be rewritten only the data which i modified has to be change

thanks in advance



 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic