Consider this simplistic snippet to replace text in a file.
$FileDat = FileRead("file.txt")
$FileDat = StringReplace($FileDat,"cat","dog")
FileDelete("file.txt")
FileWrite("file.txt",$FileDat)
How can I replace text in a file WITHOUT deleting the file and replacing it with a new one? In other words, I need a more complicated way to achieve the same functionality as above.
Nota Bene: I am using scripts to generate network file server traffic for analysis. Therefore I need examples of file modifications (not delete and write, such as above example accomplishes).
Thank you much.