From: 7stud -- Date: 2011-05-11T06:25:11+09:00 Subject: Re: gsub and multiple-replacement > Here are a few caveats: > I don't need a temp file. Yes, you do. > I am unconcerned with overwriting the username.txt file with itself. Ok, you still need a tempfile. Now, if you say you are unconcerned with losing all the data in your file, then you don't need a tempfile. The bottom line is this: you don't replace anything in a file. Instead, you read in the original file, and write out the altered lines to a new file. When you are done, you can delete the original file and rename the new file to the old file name. -- Posted via http://www.ruby-forum.com/.