Jaki1980 has asked for the wisdom of the Perl Monks concerning the following question:
what I want to do is change the value of ORA3 to become 0; I am now copying to file and trying to modify it and rename it . Don't seem to do the right thing.#MYFILE if [ $me = you ] then export ORA1=one export ORA2=3f34 export ORA3=zzzz fi
Can someone help in finding the problem or advice on a better way. thanksopen MYFILE, "<$myfile"; open COPYFILE, ">$copyfile"; while(<MYFILE>){ if (m/(ORA3=)(\w+)/) { $value=$2 } $value =~ s/$value/0/; print COPYFILE $_; } close MYFILE; close COPYFILE; system (" mv COPYFILE MYFILE ");
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: manpulating a file
by Zaxo (Archbishop) on Jan 15, 2004 at 05:44 UTC | |
by Jaki1980 (Novice) on Jan 15, 2004 at 05:52 UTC | |
|
Re: minpulating a file
by chimni (Pilgrim) on Jan 15, 2004 at 08:12 UTC |