File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Java in General and the fly likes Replacing a perticular text in property file keeping other content intact Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Soft Skills this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "Replacing a perticular text in property file keeping other content intact" Watch "Replacing a perticular text in property file keeping other content intact" New topic
Author

Replacing a perticular text in property file keeping other content intact

Ramakanta Sahoo
Ranch Hand

Joined: Aug 23, 2008
Posts: 254

Hello All,

I am having little problem in writing back to a property and log file.
What I am doing is i am searching a string in a logfile and counting the occurances of the string in the file and writing the matched strings into a file which i use to mail if the occurences increase in the logfile.
If the new count of search string will be same as old count then no mail will be sent. For that I am facing a problem in writing back the new occurance count to the property file .
Plus one more problem is in creating the logfile i want the logfile to be newly created/replaced but the matched string should get appended back to back to the new file.
How do i do it. please help
Below is my sample code



Regards, Ricky
Oracle Weblogic 10g Certified Expert TechPaste.Com
Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 40027
    
  28
Too difficult a question for beginners'. Moving.
Ramakanta Sahoo
Ranch Hand

Joined: Aug 23, 2008
Posts: 254

Ok Thanks Campbell,

I am done with the log file creation problem.
but the writing the new matched strings count back to the property file as "TCount" is still not done.
Can i edit it or i have to erite the total properties file once again. please help.

My properties file:



I want to change the TCount to the new number of matched string so that next time my program runs it will not report the same error if the TCount will be same as NewCount.
If newcount will be greater then it will send the mail and change the TCount old value to the newcount value.

I am done with all other coding but not able to write the newcount value to TCount value keeping other parameters intact.

Help Please How do i achieve this.???
Ramakanta Sahoo
Ranch Hand

Joined: Aug 23, 2008
Posts: 254

Please help???

Any Any Updates Ranchers??

Still waiting.
please help
Ramakanta Sahoo
Ranch Hand

Joined: Aug 23, 2008
Posts: 254

Finally I changed the route I was going
instead of updating inputs.properties i created a new property file with only TCount value and my program is now updating the file each time it runs.

Used mail.jar and activation.jar to send mails.



Regards,
Ricky
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Replacing a perticular text in property file keeping other content intact