From: Friday Date: 2005-05-04T22:44:46+09:00 Subject: Re: writing to a file with gsub! Robert Klemme wrote: > As others have pointed out, reading and writing to the same file at a time > is quite complicated. Your approach could only work with memory mapped > files... > > But it's simpler - as simple as > > ruby -pi.bak -e 'gsub /\d+/, "###"' your_file > This belongs in a ruby one-liner hall of fame. It is so practical and useful that it can be the perfect example to dispell any myth about ruby requiring verbose oo syntax (to newcomers reading about ruby being oo).