Beefy Boxes and Bandwidth Generously Provided by pair Networks
go ahead... be a heretic
 
PerlMonks  

Re: Can you teach a new dog an old trick?

by Chady (Priest)
on Jul 28, 2001 at 20:39 UTC ( [id://100567]=note: print w/replies, xml ) Need Help??


in reply to Can you teach a new dog an old trick?

perl -pi.bak -e "s/string1/string2/g" *

run this and it will open all files in the current directory with the inplace file edit -i and files are backed up to .bak extensions, the -p assumes that there is a while loop over the file so all you need to do is run the substitution within a -e switch and you're done with it.

Update: I stole from jeffa's post that you should have *.htm instead of * so it won't eat all the files


He who asks will be a fool for five minutes, but he who doesn't ask will remain a fool for life.

Chady | http://chady.net/

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others learning in the Monastery: (4)
As of 2024-03-29 00:57 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found