Beefy Boxes and Bandwidth Generously Provided by pair Networks
Keep It Simple, Stupid
 
PerlMonks  

Re: Compact multi-line inplace file edit search and replace

by chanio (Priest)
on Aug 23, 2005 at 06:18 UTC ( #485829=note: print w/ replies, xml ) Need Help??


in reply to Compact multi-line inplace file edit search and replace

Very creative!

But I guess that you also need to list the last part of the file.

That is, like in a huge

split
, ain't me right? It looks good for raw XML replacements :) .

(updated)

Sorry, I still can't get what the my $matched= chomp; really does... I need more practice, I guess [-(.

{ \ ( ' v ' ) / }
( \ _ / ) _ _ _ _ ` ( ) ' _ _ _ _
( = ( ^ Y ^ ) = ( _ _ ^ ^ ^ ^
_ _ _ _ \ _ ( m _ _ _ m ) _ _ _ _ _ _ _ _ _ ) c h i a n o , a l b e r t o
Wherever I lay my KNOPPIX disk, a new FREE LINUX nation could be established


Comment on Re: Compact multi-line inplace file edit search and replace
Select or Download Code
Re^2: Compact multi-line inplace file edit search and replace
by GrandFather (Cardinal) on Aug 23, 2005 at 07:40 UTC

    Actually you do get the last part of the source file. If there is just one instance of the match text in the original file then the first itteration of the loop prints the part before the match and the replacement text. The second itteration prints the part of the original file following the match text, but does not insert the replacement text.


    Perl is Huffman encoded by design.

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others studying the Monastery: (7)
As of 2014-12-29 10:38 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    Is guessing a good strategy for surviving in the IT business?





    Results (186 votes), past polls