Beefy Boxes and Bandwidth Generously Provided by pair Networks
laziness, impatience, and hubris
 
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 ( [id://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
Domain Nodelet?
Node Status?
node history
Node Type: note [id://1062360]
help
Chatterbox?
and the web crawler heard nothing...

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

    No recent polls found