John_2000
asked on
How to open a file, look for a line and replace/add text via a script?
How would you recemend that I could open a file (Test1.log) and search for a line of text then pass data to that line via a script? I have attached the file and the line I would like to edit. I would like to be able to pass 123456789 as the value between the "", then save it (ex "123456789" />)
Before
<add key="websvc.PAD.ip" value= "" />
After
<add key="websvc.PAD.ip" value= "123456789" />
Please help...
Test1.log
Before
<add key="websvc.PAD.ip" value= "" />
After
<add key="websvc.PAD.ip" value= "123456789" />
Please help...
Test1.log
ASKER
That works great! But one more thing.....If there was a value already between the quotes, it will not update. Would it be easy adjust this code to reflect that?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Nice Job!
Open in new window