I'm not sure if it's possible in any other scripting language, but using the file system object in VBScript you can essentially read in the lines, do what you want with it and replace the old file ...