Beefy Boxes and Bandwidth Generously Provided by pair Networks
No such thing as a small change
 
PerlMonks  

Re: In-place file manipulation

by broquaint (Abbot)
on Apr 30, 2003 at 14:58 UTC ( [id://254319]=note: print w/replies, xml ) Need Help??


in reply to In-place file manipulation

A sublime example for the use of the -i switch when using perl from the command line. See. perlrun for info on this marvellous switch (best used in conjunction with -p and -e).
HTH

_________
broquaint

Replies are listed 'Best First'.
Re: Re: In-place file manipulation
by perlguy (Deacon) on Apr 30, 2003 at 15:38 UTC

    I use this one all the time. A quick example of broquaint's suggested technique (from the command line), to replace all capitalization permutations of the word 'perl' to 'Perl' in file perl.pl, and store the original in perl.pl.bak:

    perl -pi.bak -e 's/\bperl\b/Perl/gi' perl.pl

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://254319]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others having an uproarious good time at the Monastery: (2)
As of 2024-04-25 19:02 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found