Beefy Boxes and Bandwidth Generously Provided by pair Networks
We don't bite newbies here... much
 
PerlMonks  

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

by ig (Vicar)
on Nov 13, 2013 at 06:15 UTC ( #1062335=note: print w/replies, xml ) Need Help??


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 $_; } ~

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others contemplating the Monastery: (1)
As of 2023-06-02 17:54 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?