in reply to Script behaving differently on Linux vs windows
Are you needing to write back to the file as well afterwards? Your opening sentence makes it unclear.