Andrew Johnson
4/22/2006 5:29:00 PM
On 22 Apr 2006 09:56:15 -0700, Trans <transfire@gmail.com> wrote:
> Just an FYI, this little one-line can come it quite handy:
>
> ruby -pi -w -e 'gsub!(/search/, "replace")' *.rb
>
> Use it to seach through your ruby script files doing a global search
> and replace. Be careful though. Make a mistake using it and you'll be
> wanting a backup!
Hence, specifying a backup extension is a good idea:
ruby -wpi.bak -e '...' xfiles
Now xfiles will first be backed up as xfiles.bak
andrew