Beefy Boxes and Bandwidth Generously Provided by pair Networks
Pathologically Eclectic Rubbish Lister
 
PerlMonks  

Re: Re^2: Large scale search and replace with perl -i

by runrig (Abbot)
on Apr 14, 2003 at 21:01 UTC ( [id://250417]=note: print w/replies, xml ) Need Help??


in reply to Re^2: Large scale search and replace with perl -i (don't grep(1))
in thread Large scale search and replace with perl -i

find . -name "*.html" -type f -print0 | perl -i -p0e \ 'BEGIN{ @ARGV = <STDIN>; chomp @ARGV; $/ = \65536 }; \ while (<>) { s/foo/bar/g; print }'
You don't want to do that. If 'foo' spans across one of those read blocks, then you'll miss the substitution.

Replies are listed 'Best First'.
Re^4: Large scale search and replace with perl -i (doh!)
by Aristotle (Chancellor) on Apr 14, 2003 at 21:07 UTC
    Duh.. I can't believe I didn't think of that.

    Makeshifts last the longest.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others wandering the Monastery: (7)
As of 2024-04-18 17:29 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found