Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:
what I am trying to do is open that file and for the function monks change the value 2329 in the insert statment to somthing else let's say 9999 so my input file should look the same except for this lineecho "insert into table1 values ('$1',sysdate,null,null,null,'OP',nul +l,'$5','IR',$2,$4,$3);" >> $OPONE } COW () { echo "insert into COLL values ('$1',sysdate,null,null,null,'OP',null,' +$5','$2','$3','$4','$6','0');" >> $OPCOW L_FILE } MONKS () { echo "insert into monks values ('$1',sysdate,null,null,null,'OP',null, +'$8','$5',2329,$2,$4,$3);" >> $OPTHREE } ARAMPSBADJ () { echo "insert into aramp values ('$1',sysdate,null,null,null,'OP',null, +'B');" >> $OP }
Can some one show me the best way to do it : , I am trying somthing likeMONKS () { echo "insert into monks values ('$1',sysdate,null,null,null,'OP',null, +'$8','$5',9999,$2,$4,$3);" >> $OPTHREE }
while(<INPUT>) { if ( $flag == 1 ) { s/MONKSPART/MONKSPART$newchanges/ if /MONKS ()/; $flag = 0 if /^fi/; } $flag = 1 if /^}/; }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Changing input file
by CountZero (Bishop) on Feb 06, 2004 at 20:53 UTC |