in reply to Modifying a file

This question comes up quite often, for example change a line or string in file handles the same question and provides a few solutions. Also you could look into our FAQ.