S
suzy
hello,
i want to search a text file for an occurrence of a string and replace some
text after the match, then save the file.
eg: if the file is:
<start>
Hello my name is tony, I am 22.
Hello, my name is sonia, I am 18.
Hello, my name is debbie, I am 8.
<end>
I would like to pass in a search string of "I am " and I also want to be
able to increment each of the ages by 1, then save the file.
So the output file would be:
<start>
Hello my name is tony, I am 23.
Hello, my name is sonia, I am 19.
Hello, my name is debbie, I am 9.
<end>
What is the best way to do this?
Many thanks.
i want to search a text file for an occurrence of a string and replace some
text after the match, then save the file.
eg: if the file is:
<start>
Hello my name is tony, I am 22.
Hello, my name is sonia, I am 18.
Hello, my name is debbie, I am 8.
<end>
I would like to pass in a search string of "I am " and I also want to be
able to increment each of the ages by 1, then save the file.
So the output file would be:
<start>
Hello my name is tony, I am 23.
Hello, my name is sonia, I am 19.
Hello, my name is debbie, I am 9.
<end>
What is the best way to do this?
Many thanks.