http://qs321.pair.com?node_id=1062335


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

You might find Getting Started with Perl helpful. There are references to many resources there.

  • Comment on Re: Parse a file, replace a particular strings and save new file

Replies are listed 'Best First'.
Re^2: Parse a file, replace a particular strings and save new file
by sanku (Beadle) on Nov 13, 2013 at 09:36 UTC
    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 $_; } ~