From: Luis Parravicini Date: 2007-06-12T05:08:29+09:00 Subject: Re: Ruby way to update a file in place On 6/11/07, Li Chen wrote: > I just wonder what is the Ruby way to update a file in place. Do I need > to open a temporary/new file for writing and then rename the temporary > file? There is also the '-i' argument to ruby. The example is from the man page: ================================ % echo matz > /tmp/junk % cat /tmp/junk matz % ruby -p -i.bak -e "$_.upcase!" /tmp/junk % cat /tmp/junk MATZ % cat /tmp/junk.bak matz ================================ -- Luis Parravicini http://ktulu.com.ar/blog/