Beefy Boxes and Bandwidth Generously Provided by pair Networks
Syntactic Confectionery Delight
 
PerlMonks  

Re: substitute a word in the whole file .. how ???

by dbwiz (Curate)
on Aug 13, 2003 at 11:28 UTC ( #283508=note: print w/replies, xml ) Need Help??


in reply to substitute a word in the whole file .. how ???

perl -i.bak -pe 's/frog/toad/g' txtfile

This one-liner will save your old file into txtfile.bak, and modify txtfile by changing every occurrence of "frog" into "toad".

See perlrun for details on the command line arguments.

Replies are listed 'Best First'.
A reply falls below the community's threshold of quality. You may see it by logging in.

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others contemplating the Monastery: (5)
As of 2021-11-30 20:21 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?