Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl: the Markov chain saw
 
PerlMonks  

Re^2: Parse a file, replace a particular strings and save new file

by sanku (Beadle)
on Nov 13, 2013 at 09:36 UTC ( #1062360=note: print w/replies, xml ) Need Help??


in reply to Re: Parse a file, replace a particular strings and save new file
in thread Parse a file, replace a particular strings and save new file

Hi, Try this code
my ($v1,$value,$i); open (FILE,"old.txt") or die $!; open (NEW,">new.txt") or die $!; while(<FILE>){ if($_ =~/string_/){ ($v1, $v2) = split(/name/,$_); ($value) = split(/\(/,$v2); } $_ =~s/values/$value/; print NEW $_; } ~
  • Comment on Re^2: Parse a file, replace a particular strings and save new file
  • Download Code

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others meditating upon the Monastery: (4)
As of 2020-10-20 12:44 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    My favourite web site is:












    Results (210 votes). Check out past polls.

    Notices?