Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:
I need to only change the nubmer 2329 to 9999 under the monks part and re write it to the same file so my Output should contain the MONKS part as follow:LOSER () { echo "insert into monks values ('$1',sysdate,null,null,null,'OP',null, +'$8',23,$3);" >> $OPTHREE } TEST () { echo "insert into monks values ('$1',sysdate,null,null,null,'OP',null, +'$8','$5',9,$2,$4,$3);" >> $OPTHREE # the following line should remain unchanged echo "insert into monks values ('$1',sysdate,null,null,null,'OP',null, +'$8',2329,$3);" >> $OPTHREE } MONKS () { echo "insert into monks values ('$1',sysdate,null,null,null,'OP',null, +'$8',2329,$3);" >> $OPTHREE }
I am doing the following but not getting the result I want it just not chanigning the value , can someone help:MONKS () { echo "insert into monks values ('$1',sysdate,null,null,null,'OP',null, +'$8',9999,$3);" >> $OPTHREE }
thanksuse strict; use warnings; my $text = do { local $/; <DATA> }; $text =~ s/(MONKS[\s\(\)]+{.*?,\s*?)2329(\s*?,[^}]*})/${1}9999${2}/sg; print "$text";
janitored by ybiC: Retitle from "exreg within an input file" for better searching
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: regex within an input file
by Art_XIV (Hermit) on Feb 09, 2004 at 14:54 UTC | |
|
Re: regex within an input file
by ysth (Canon) on Feb 09, 2004 at 14:50 UTC | |
|
Re: regex within an input file
by Anonymous Monk on Feb 09, 2004 at 14:44 UTC | |
|
Re: exreg within an input file
by John M. Dlugosz (Monsignor) on Feb 09, 2004 at 20:15 UTC |