Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:
and only change the nubmer 2329 to 9999 under the monks part. What I have so far is not working :TEST () { echo "insert into monks values ('$1',sysdate,null,null,null,'OP',null, +'$8','$5',9,$2,$4,$3);" >> $OPTHREE } MONKS () { echo "insert into monks values ('$1',sysdate,null,null,null,'OP',null, +'$8',2329,$3);" >> $OPTHREE }
open ( INPUT , "../INPUT" ) or die " couldn't open \n"; open ( COPYFILE , ">../INPUT/copyfile" ) or die " couldn't open file + for input\n"; my $flag = 0; # set this to 1 when you see your market # set it to 0 when you see END while(<INPUT>) { if ( $flag == 1 ) { s/MONKS.+?(2329)/9999/; $flag = 0 if /^}/; } $flag = 1 if /MONKS/; print COPYFILE; } close (COPYFILE); close(INPUT);
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: changing input file updated
by Roger (Parson) on Feb 06, 2004 at 22:43 UTC | |
|
Re: changing input file updated
by CountZero (Bishop) on Feb 06, 2004 at 22:34 UTC |