Noame has asked for the wisdom of the Perl Monks concerning the following question:
Hi,
I need to retrieve the following line from UBB file and replace some data within with variables value. The line is:
grep -iw NASIT GPPconfig.ubb.orig.06Nov2007 OPENINFO="Oracle_XA:Oracle_XA+Acc=P/NASIT/nasit+SesTm=60+SqlNet=QA +NASIT+LogDir=/users/nas/disk1/data/traces+DB=QANASIT+Objects=true+Thr +eads=true"
The variables are: $DBUser, $DBPass, $DBSid Should to replace the data in the line as describe below:
OPENINFO="Oracle_XA:Oracle_XA+Acc=P/$DBUser/$DBPass+SesTm=60+SqlNet=$D +BSid+LogDir=/users/nas/disk1/data/traces+DB=$DBSid+Objects=true+Threa +ds=true"
And save the file with the new data.
some part of the line are contestant so we can use regular expression - Those parts are marked with Bold and underline:
Please advice the best way to do it.
Regards.
Noame.
20071111 Janitored by Corion: Removed HTML, added formatting, code tags, as per Writeup Formatting Tips
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Regular expression
by moritz (Cardinal) on Nov 11, 2007 at 08:30 UTC | |
|
Re: Regular expression
by Krambambuli (Curate) on Nov 11, 2007 at 09:48 UTC | |
by Noame (Beadle) on Nov 11, 2007 at 15:31 UTC | |
by Krambambuli (Curate) on Nov 11, 2007 at 16:39 UTC |