Beefy Boxes and Bandwidth Generously Provided by pair Networks
Your skill will accomplish
what the force of many cannot
 
PerlMonks  

Re: Large scale search and replace with perl -i

by BrowserUk (Patriarch)
on Apr 15, 2003 at 02:05 UTC ( [id://250450]=note: print w/replies, xml ) Need Help??

Help for this page

Select Code to Download


  1. or download this
    find . -name "*.html" -type f -print0 | \
    perl -i -p0e \
     'BEGIN{ @ARGV = <STDIN>; chomp @ARGV; $/ = '' }; \
      while (<>) { s/foo/bar/g; print }'
    
  2. or download this
    find . -type d -print0 | \
    perl -i -p0e \
    ...
     @ARGV = map{glob "$_/*.html"}; \
     $/ = '' }; \
      while (<>) { s/foo/bar/g; print }'
    

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others meditating upon the Monastery: (4)
As of 2024-04-25 17:07 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found