<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: How to replace a string like $mystring in a file in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/how-to-replace-a-string-like-mystring-in-a-file/m-p/7020529#M495735</link>
    <description>&lt;P&gt;&amp;gt; How to replace the string $ORACLE_HOME by the value of my environment&lt;BR /&gt;&amp;gt; variable in my file?&lt;BR /&gt;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; sed?&lt;BR /&gt;&lt;BR /&gt;&amp;gt; note: My environment variable is something like that:&lt;BR /&gt;&amp;gt; /logiciel/app/oracle/product/11.2.0.4&lt;BR /&gt;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; What, exactly, is the problem?&amp;nbsp; Evaluating the environment variable,&lt;BR /&gt;or dealing with "/", or what?&lt;BR /&gt;&lt;BR /&gt;mba$ export MEV='F/R/E/D'&lt;BR /&gt;mba$ echo $MEV&lt;BR /&gt;mba$ echo 'xxxx$O_Hyyyy' | sed -e 's|$O_H|'"$MEV"'|'&lt;BR /&gt;xxxxF/R/E/Dyyyy&lt;/P&gt;</description>
    <pubDate>Thu, 04 Oct 2018 16:02:30 GMT</pubDate>
    <dc:creator>Steven Schweda</dc:creator>
    <dc:date>2018-10-04T16:02:30Z</dc:date>
    <item>
      <title>How to replace a string like $mystring in a file</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/how-to-replace-a-string-like-mystring-in-a-file/m-p/7020481#M495734</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here is the content of a file:&lt;/P&gt;&lt;P&gt;...&lt;/P&gt;&lt;P&gt;CURRENT===BLKSIZE=1048576,SBT_LIBRARY=$ORACLE_HOME/lib/libddobk.so,ENV=(STORAGE_UNIT=oramtsrepl,BACKUP_HOST=dedcti1data,ORACLE_HOME=$ORACLE_HOME)&lt;/P&gt;&lt;P&gt;...&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;How to replace the string $ORACLE_HOME by the value of my environment variable in my file?&lt;/P&gt;&lt;P&gt;note: My environment variable is something like that: /logiciel/app/oracle/product/11.2.0.4&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Kind regards,&lt;/P&gt;&lt;P&gt;Den.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 04 Oct 2018 09:25:21 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/how-to-replace-a-string-like-mystring-in-a-file/m-p/7020481#M495734</guid>
      <dc:creator>SwissKnife</dc:creator>
      <dc:date>2018-10-04T09:25:21Z</dc:date>
    </item>
    <item>
      <title>Re: How to replace a string like $mystring in a file</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/how-to-replace-a-string-like-mystring-in-a-file/m-p/7020529#M495735</link>
      <description>&lt;P&gt;&amp;gt; How to replace the string $ORACLE_HOME by the value of my environment&lt;BR /&gt;&amp;gt; variable in my file?&lt;BR /&gt;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; sed?&lt;BR /&gt;&lt;BR /&gt;&amp;gt; note: My environment variable is something like that:&lt;BR /&gt;&amp;gt; /logiciel/app/oracle/product/11.2.0.4&lt;BR /&gt;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; What, exactly, is the problem?&amp;nbsp; Evaluating the environment variable,&lt;BR /&gt;or dealing with "/", or what?&lt;BR /&gt;&lt;BR /&gt;mba$ export MEV='F/R/E/D'&lt;BR /&gt;mba$ echo $MEV&lt;BR /&gt;mba$ echo 'xxxx$O_Hyyyy' | sed -e 's|$O_H|'"$MEV"'|'&lt;BR /&gt;xxxxF/R/E/Dyyyy&lt;/P&gt;</description>
      <pubDate>Thu, 04 Oct 2018 16:02:30 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/how-to-replace-a-string-like-mystring-in-a-file/m-p/7020529#M495735</guid>
      <dc:creator>Steven Schweda</dc:creator>
      <dc:date>2018-10-04T16:02:30Z</dc:date>
    </item>
    <item>
      <title>Re: How to replace a string like $mystring in a file</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/how-to-replace-a-string-like-mystring-in-a-file/m-p/7020573#M495736</link>
      <description>&lt;P&gt;Hi Steven,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I can simplify the problem with short code:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;ORACLE_HOME='/logiciel/app/oracle/product/11.2.0.4'&lt;BR /&gt;PRM_PARMS='AA=$ORACLE_HOME is the value of ORACLE_HOME'&lt;BR /&gt;echo $PRM_PARMS | sed '.....What is the syntax here....'&lt;/P&gt;&lt;P&gt;echo should return:&lt;/P&gt;&lt;P&gt;AA=/logiciel/app/oracle/product/11.2.0.4 is the value of ORACLE_HOME&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have tried this (and a lot of other variations ;-) without success:&lt;/P&gt;&lt;P&gt;echo $PRM_PARMS | sed 's,'$ORACLE_HOME',$ORACLE_HOME,'&lt;/P&gt;&lt;P&gt;=&amp;gt; does not work&lt;/P&gt;&lt;P&gt;echo $PRM_PARMS | sed -e "s/\$ORACLE_HOME/$ORACLE_HOME/g"&lt;/P&gt;&lt;P&gt;=&amp;gt; does not work&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Kind regards,&lt;/P&gt;&lt;P&gt;Den.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 05 Oct 2018 07:44:15 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/how-to-replace-a-string-like-mystring-in-a-file/m-p/7020573#M495736</guid>
      <dc:creator>SwissKnife</dc:creator>
      <dc:date>2018-10-05T07:44:15Z</dc:date>
    </item>
    <item>
      <title>Re: How to replace a string like $mystring in a file</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/how-to-replace-a-string-like-mystring-in-a-file/m-p/7020620#M495737</link>
      <description>&lt;P&gt;FYI,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Solved!!&lt;/P&gt;&lt;P&gt;echo $PRM_PARMS | sed -e "s+\$ORACLE_HOME+$ORACLE_HOME+g"&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Kind regards,&lt;/P&gt;&lt;P&gt;Den.&lt;/P&gt;</description>
      <pubDate>Fri, 05 Oct 2018 13:21:05 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/how-to-replace-a-string-like-mystring-in-a-file/m-p/7020620#M495737</guid>
      <dc:creator>SwissKnife</dc:creator>
      <dc:date>2018-10-05T13:21:05Z</dc:date>
    </item>
    <item>
      <title>Re: How to replace a string like $mystring in a file</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/how-to-replace-a-string-like-mystring-in-a-file/m-p/7020631#M495738</link>
      <description>&lt;P&gt;&amp;gt; echo $PRM_PARMS | sed 's,'$ORACLE_HOME',$ORACLE_HOME,'&lt;BR /&gt;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; You need to do something to keep the shell from treating the first&lt;BR /&gt;"$" (only) as special.&amp;nbsp; I used apostrophes.&lt;BR /&gt;&lt;BR /&gt;&amp;gt; echo $PRM_PARMS | sed -e "s/\$ORACLE_HOME/$ORACLE_HOME/g"&lt;BR /&gt;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; You can't use "/" for the sed:s delimiter if "/" appears in the&lt;BR /&gt;string.&lt;BR /&gt;&lt;BR /&gt;&amp;gt; echo $PRM_PARMS | sed -e "s+\$ORACLE_HOME+$ORACLE_HOME+g"&lt;BR /&gt;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; Yes, a "\" can do the first job instead of apostrophes, and "+" will&lt;BR /&gt;do the second job as well as "|", so long as neither appears in the&lt;BR /&gt;string.&amp;nbsp; And "g" will help if you have more than one instance.&amp;nbsp; You&lt;BR /&gt;could add a "g" to my suggestion, too.&lt;/P&gt;</description>
      <pubDate>Fri, 05 Oct 2018 14:31:16 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/how-to-replace-a-string-like-mystring-in-a-file/m-p/7020631#M495738</guid>
      <dc:creator>Steven Schweda</dc:creator>
      <dc:date>2018-10-05T14:31:16Z</dc:date>
    </item>
  </channel>
</rss>

