in reply to simple substitution

perl -pi.bak -e 's/this/that/g' file.txt

cheers

tachyon

Replies are listed 'Best First'.
Re: Re: simple substitution
by jweed (Chaplain) on Jan 04, 2004 at 08:13 UTC
    Or, equivalently,
    local $^I = '.bak'; while (<>) { s/this/that/g; print; }


    Who is Kayser Söze?
    Code is (almost) always untested.

      Challenge: find the quote -> 'too many notes (jweed), too many notes'

      cheers

      tachyon

        I used just as many notes as were necessary. Neither more nor less, Mr. Emperor of Austria. Plus, If he wants to do more than just a simple substitution eventually a one-liner quickly becomes unwieldy.


        Who is Kayser Söze?
        Code is (almost) always untested.