Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl Monk, Perl Meditation
 
PerlMonks  

Re: File Find/Replace with the replacement coming from part of earlier matched string

by LanX (Bishop)
on Feb 05, 2013 at 03:36 UTC ( #1017048=note: print w/replies, xml ) Need Help??


in reply to File Find/Replace with the replacement coming from part of earlier matched string

What did you try?

I would read line by line and try to match the headlines with a regex in an if statement.

if match headline then capture headline in variable else if empty line then print empty line else print captured headline + current line

hmm ... almost Python! :)

Cheers Rolf

  • Comment on Re: File Find/Replace with the replacement coming from part of earlier matched string
  • Download Code

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1017048]
help
Chatterbox?
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others scrutinizing the Monastery: (7)
As of 2018-06-21 14:47 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Should cpanminus be part of the standard Perl release?



    Results (118 votes). Check out past polls.

    Notices?