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:

OPENINFO="Oracle_XA:Oracle_XA+Acc=P/$DBUser/$DBPass+SesTm=60+SqlNet=$DBSid+LogDir=/users/nas/disk1/data/traces+DB=$DBSid+Objects=true+Threads=true"

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


In reply to Regular expression by Noame

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.