in reply to Re: String substitution
in thread String substitution

Is there a way to use: perl -pi.bak -e 's/apple/orange/gi' c:\data w/o the '-pi.bak' part; without making a backup of the file

Replies are listed 'Best First'.
Re^3: String substitution
by ikegami (Patriarch) on Aug 09, 2006 at 20:36 UTC
    The p and the i are seperate options. You definitely want to keep the p, and you definitely want to keep the i ("inplace"), but if you don't specify an extention, the backup file isn't created. This is all documented in perlrun.
    perl -pi -e 's/apple/orange/gi'

    Caveat: i without an extention does not work in Windows.