changing particular string in text file
I have a text file with this format:
aaa:bbb:ccc
ddd:eee:fff
ggg:hhh:iii
so now i want to search for fff and replace it with kkk but in same file. i know how to do by pasting stuff in other file. but for this i need that to be in same file
any help will be appreciated
Thanks
Re: changing particular string in text file
Just write in a separate file, delete the old and rename the new. Alternatively, read the file into memory, do the manipulation, then write to the file of the name of your choosing.
Re: changing particular string in text file
I tried that b4 writing to memory but it didnt work for me.. what i want is not to change the file. let say i have this input.txt file i want the changes to occur in that particular file not in output.txt file ( file has to be same) . I have the code for coping one file to another when u make changes but, i want the file name to be same...
any idea or do you have any example code