<?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: sed nightmare in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/sed-nightmare/m-p/2677383#M906992</link>
    <description>Hi Bill,&lt;BR /&gt;&lt;BR /&gt;only diffrence I saw is, that in the Script you have some variables, which you expanded in your direct call. In this case the type of quotes you use may have impact.&lt;BR /&gt;&lt;BR /&gt;The output seems somewhat disformatted.&lt;BR /&gt;Could you attach it ?&lt;BR /&gt;&lt;BR /&gt;Volker</description>
    <pubDate>Wed, 06 Mar 2002 18:18:36 GMT</pubDate>
    <dc:creator>Volker Borowski</dc:creator>
    <dc:date>2002-03-06T18:18:36Z</dc:date>
    <item>
      <title>sed nightmare</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/sed-nightmare/m-p/2677379#M906988</link>
      <description>why does set work from commandline as expected, but not in script?&lt;BR /&gt;&lt;BR /&gt;+ echo&lt;BR /&gt;+ 1&amp;gt;&amp;gt; /etc/opt/config/UserConfig.properties&lt;BR /&gt;+ set -x&lt;BR /&gt;+ sed -e s|^ocmp.config.file.start.*|ocmp.config.file.start=Configitious.xml| /etc/opt/config/UserConfig.properties&lt;BR /&gt;+ 1&amp;gt; /tmp/tmp4487&lt;BR /&gt;+ echo return code=0 : tempfile=tmp4487 : UserConfig=/etc/opt/config/UserConfig.properties&lt;BR /&gt;return code=0 : tempfile=tmp4487 : UserConfig=/etc/opt/config/UserConfig.properties&lt;BR /&gt;+ mv /tmp/tmp4487 /etc/opt/config/UserConfig.properties&lt;BR /&gt;+ echo return code=0 : tempfile=tmp4487 : UserConfig=/etc/opt/config/UserConfig.properties&lt;BR /&gt;return code=0 : tempfile=tmp4487 : UserConfig=/etc/opt/config/UserConfig.properties&lt;BR /&gt;+ chown ocmpadm:ocadmin /etc/opt/config/UserConfig.properties&lt;BR /&gt;+ chmod 766 /etc/opt/config/UserConfig.properties&lt;BR /&gt;&lt;BR /&gt;script:&lt;BR /&gt;&lt;BR /&gt;echo " " &amp;gt;&amp;gt; $USERPROP&lt;BR /&gt;set -x&lt;BR /&gt;sed -e "s|^ocmp.config.file.start.*|ocmp.config.file.start=${NEWCONFIG}|" ${USERPROP} &amp;gt; /tmp/tmp$$&lt;BR /&gt;echo "return code=$? : tempfile=tmp$$ : UserConfig=$USERPROP"&lt;BR /&gt;mv /tmp/tmp$$ $USERPROP&lt;BR /&gt;echo "return code=$? : tempfile=tmp$$ : UserConfig=$USERPROP"&lt;BR /&gt;&lt;BR /&gt;Later,&lt;BR /&gt;Bill</description>
      <pubDate>Wed, 06 Mar 2002 17:41:07 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/sed-nightmare/m-p/2677379#M906988</guid>
      <dc:creator>Bill McNAMARA_1</dc:creator>
      <dc:date>2002-03-06T17:41:07Z</dc:date>
    </item>
    <item>
      <title>Re: sed nightmare</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/sed-nightmare/m-p/2677380#M906989</link>
      <description>Hi Bill,&lt;BR /&gt;&lt;BR /&gt;Try using the absolute path to sed, /usr/bin/sed.&lt;BR /&gt;&lt;BR /&gt;you can also put the shell in the first line and try,&lt;BR /&gt;&lt;BR /&gt;#!/usr/bin/sh&lt;BR /&gt;&lt;BR /&gt;Hope this helps.&lt;BR /&gt;&lt;BR /&gt;regds&lt;BR /&gt;</description>
      <pubDate>Wed, 06 Mar 2002 17:53:53 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/sed-nightmare/m-p/2677380#M906989</guid>
      <dc:creator>Sanjay_6</dc:creator>
      <dc:date>2002-03-06T17:53:53Z</dc:date>
    </item>
    <item>
      <title>Re: sed nightmare</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/sed-nightmare/m-p/2677381#M906990</link>
      <description>no joy,&lt;BR /&gt;the destination file is empty and the tmp$$ file is not created.&lt;BR /&gt;</description>
      <pubDate>Wed, 06 Mar 2002 18:10:37 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/sed-nightmare/m-p/2677381#M906990</guid>
      <dc:creator>Bill McNAMARA_1</dc:creator>
      <dc:date>2002-03-06T18:10:37Z</dc:date>
    </item>
    <item>
      <title>Re: sed nightmare</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/sed-nightmare/m-p/2677382#M906991</link>
      <description>Bill&lt;BR /&gt;&lt;BR /&gt;In scripts always put the full path to ANY command that you call - set , sed , mv ,cp , chown ,chmod etc.&lt;BR /&gt;&lt;BR /&gt;9 time out of 10 it will work ok without this, but err on the safe side.&lt;BR /&gt;&lt;BR /&gt;As Sanjay has said it is also best to define your shell as the first line.&lt;BR /&gt;&lt;BR /&gt;#!/bin/sh&lt;BR /&gt;# Script from here down.&lt;BR /&gt;Bla bla bla&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;HTH&lt;BR /&gt;&lt;BR /&gt;Paula</description>
      <pubDate>Wed, 06 Mar 2002 18:12:49 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/sed-nightmare/m-p/2677382#M906991</guid>
      <dc:creator>Paula J Frazer-Campbell</dc:creator>
      <dc:date>2002-03-06T18:12:49Z</dc:date>
    </item>
    <item>
      <title>Re: sed nightmare</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/sed-nightmare/m-p/2677383#M906992</link>
      <description>Hi Bill,&lt;BR /&gt;&lt;BR /&gt;only diffrence I saw is, that in the Script you have some variables, which you expanded in your direct call. In this case the type of quotes you use may have impact.&lt;BR /&gt;&lt;BR /&gt;The output seems somewhat disformatted.&lt;BR /&gt;Could you attach it ?&lt;BR /&gt;&lt;BR /&gt;Volker</description>
      <pubDate>Wed, 06 Mar 2002 18:18:36 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/sed-nightmare/m-p/2677383#M906992</guid>
      <dc:creator>Volker Borowski</dc:creator>
      <dc:date>2002-03-06T18:18:36Z</dc:date>
    </item>
    <item>
      <title>Re: sed nightmare</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/sed-nightmare/m-p/2677384#M906993</link>
      <description>Hi&lt;BR /&gt;Bill&lt;BR /&gt;Just an idea have a look in the root dir or the dir you are running from for the tempfile,&lt;BR /&gt;as the echo of the tmpfile is not showing a path&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Paula</description>
      <pubDate>Wed, 06 Mar 2002 18:23:33 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/sed-nightmare/m-p/2677384#M906993</guid>
      <dc:creator>Paula J Frazer-Campbell</dc:creator>
      <dc:date>2002-03-06T18:23:33Z</dc:date>
    </item>
    <item>
      <title>Re: sed nightmare</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/sed-nightmare/m-p/2677385#M906994</link>
      <description>attached</description>
      <pubDate>Wed, 06 Mar 2002 18:27:31 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/sed-nightmare/m-p/2677385#M906994</guid>
      <dc:creator>Bill McNAMARA_1</dc:creator>
      <dc:date>2002-03-06T18:27:31Z</dc:date>
    </item>
    <item>
      <title>Re: sed nightmare</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/sed-nightmare/m-p/2677386#M906995</link>
      <description>Bill, I'm not entirely certain I understand your problem, but "set -x" sends its output to STDERR.  If you are scriting it, you need to redirect output strem 2 into the logfile to capture the "+ messages".</description>
      <pubDate>Wed, 06 Mar 2002 18:27:34 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/sed-nightmare/m-p/2677386#M906995</guid>
      <dc:creator>Alan Riggs</dc:creator>
      <dc:date>2002-03-06T18:27:34Z</dc:date>
    </item>
    <item>
      <title>Re: sed nightmare</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/sed-nightmare/m-p/2677387#M906996</link>
      <description>Bill&lt;BR /&gt;&lt;BR /&gt;Your line :-&lt;BR /&gt;&lt;BR /&gt;sed -e "s|^ocmp.config.file.start.*|ocmp.config.file.start=Configitious.xml|" $USERPROP &amp;gt; /tmp/tmp$$&lt;BR /&gt;&lt;BR /&gt;try it with the full path to sed:-&lt;BR /&gt;&lt;BR /&gt;/usr/bin/sed -e "s|^ocmp.config.file.start.*|ocmp.config.file.start=Configitious.xml|" $USERPROP &amp;gt; /tmp/tmp$$&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Paula</description>
      <pubDate>Wed, 06 Mar 2002 18:39:38 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/sed-nightmare/m-p/2677387#M906996</guid>
      <dc:creator>Paula J Frazer-Campbell</dc:creator>
      <dc:date>2002-03-06T18:39:38Z</dc:date>
    </item>
    <item>
      <title>Re: sed nightmare</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/sed-nightmare/m-p/2677388#M906997</link>
      <description>no joy Paula..&lt;BR /&gt;&lt;BR /&gt;Have you tried it?&lt;BR /&gt;&lt;BR /&gt;Later,&lt;BR /&gt;Bill</description>
      <pubDate>Wed, 06 Mar 2002 18:46:20 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/sed-nightmare/m-p/2677388#M906997</guid>
      <dc:creator>Bill McNAMARA_1</dc:creator>
      <dc:date>2002-03-06T18:46:20Z</dc:date>
    </item>
    <item>
      <title>Re: sed nightmare</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/sed-nightmare/m-p/2677389#M906998</link>
      <description>perhaps the quotes are causing a problem...&lt;BR /&gt;&lt;BR /&gt;Bill</description>
      <pubDate>Wed, 06 Mar 2002 18:50:16 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/sed-nightmare/m-p/2677389#M906998</guid>
      <dc:creator>Bill McNAMARA_1</dc:creator>
      <dc:date>2002-03-06T18:50:16Z</dc:date>
    </item>
    <item>
      <title>Re: sed nightmare</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/sed-nightmare/m-p/2677390#M906999</link>
      <description>Bill&lt;BR /&gt;&lt;BR /&gt;Have you tried:-&lt;BR /&gt;&lt;BR /&gt;1.  Put your sh as #!/bin/ksh&lt;BR /&gt;2.  Run ksh -x &amp;lt;scriptname&amp;gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;It might give an little more info.&lt;BR /&gt;&lt;BR /&gt;Paula&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Wed, 06 Mar 2002 18:51:49 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/sed-nightmare/m-p/2677390#M906999</guid>
      <dc:creator>Paula J Frazer-Campbell</dc:creator>
      <dc:date>2002-03-06T18:51:49Z</dc:date>
    </item>
    <item>
      <title>Re: sed nightmare</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/sed-nightmare/m-p/2677391#M907000</link>
      <description>works for me ....&lt;BR /&gt;&lt;BR /&gt;# cat bastel.txt&lt;BR /&gt;#User defined default and start config&lt;BR /&gt;#Thu Feb 07 12:02:28 CET 2002&lt;BR /&gt;ocmp.config.file.start=7.intro.xml&lt;BR /&gt;&lt;BR /&gt;# cat script&lt;BR /&gt;#!/usr/bin/ksh&lt;BR /&gt;set -x&lt;BR /&gt;export USERPROP=bastel.txt&lt;BR /&gt;sed -e "s|^ocmp.config.file.start.*|ocmp.config.file.start=Configitious.xml|" $USERPROP &amp;gt; out$$&lt;BR /&gt;mv out$$ weg&lt;BR /&gt;&lt;BR /&gt;# ./script&lt;BR /&gt;+ export USERPROP=bastel.txt&lt;BR /&gt;+ sed -e s|^ocmp.config.file.start.*|ocmp.config.file.start=Configitious.xml| bastel.txt&lt;BR /&gt;+ 1&amp;gt; out12026&lt;BR /&gt;+ mv out12026 weg&lt;BR /&gt;&lt;BR /&gt;# cat weg&lt;BR /&gt;#User defined default and start config&lt;BR /&gt;#Thu Feb 07 12:02:28 CET 2002&lt;BR /&gt;ocmp.config.file.start=Configitious.xml&lt;BR /&gt;&lt;BR /&gt;# &lt;BR /&gt;&lt;BR /&gt;Replace OK, rest of file untouched !&lt;BR /&gt;&lt;BR /&gt;????&lt;BR /&gt;&lt;BR /&gt;Any corrupt chars inside the script or the config file, that do not show up with cat ?&lt;BR /&gt;Like ^M when transfered from WIN ?&lt;BR /&gt;&lt;BR /&gt;Sorry, no idea, looks OK !&lt;BR /&gt;&lt;BR /&gt;Volker</description>
      <pubDate>Wed, 06 Mar 2002 18:54:19 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/sed-nightmare/m-p/2677391#M907000</guid>
      <dc:creator>Volker Borowski</dc:creator>
      <dc:date>2002-03-06T18:54:19Z</dc:date>
    </item>
    <item>
      <title>Re: sed nightmare</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/sed-nightmare/m-p/2677392#M907001</link>
      <description>Hi Bill,&lt;BR /&gt;&lt;BR /&gt;Looks like the sed is working. You don't see the tmp$$ file because it has been moved to $USERPROP&lt;BR /&gt;&lt;BR /&gt;The original $USERPROP has &lt;BR /&gt;#User defined default and start config&lt;BR /&gt;#Thu Feb 07 12:02:28 CET 2002&lt;BR /&gt;ocmp.config.file.start=7.intro.xml&lt;BR /&gt;&lt;BR /&gt;The modified $USERPROP has,&lt;BR /&gt;&lt;BR /&gt;User defined default and start config&lt;BR /&gt;#Thu Feb 07 12:02:28 CET 2002&lt;BR /&gt;ocmp.config.file.start=Configitious.xml&lt;BR /&gt;&lt;BR /&gt;You have moved the tmp$$ file to $USERPROP over here,&lt;BR /&gt;&lt;BR /&gt;mv /tmp/tmp$$ $USERPROP&lt;BR /&gt;&lt;BR /&gt;Hope this helps.&lt;BR /&gt;&lt;BR /&gt;Regds&lt;BR /&gt;</description>
      <pubDate>Wed, 06 Mar 2002 18:55:26 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/sed-nightmare/m-p/2677392#M907001</guid>
      <dc:creator>Sanjay_6</dc:creator>
      <dc:date>2002-03-06T18:55:26Z</dc:date>
    </item>
    <item>
      <title>Re: sed nightmare</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/sed-nightmare/m-p/2677393#M907002</link>
      <description>Bill&lt;BR /&gt;&lt;BR /&gt;Perhaps I am being dense.  In the section you &lt;SNIPPED&gt; out, you appear to move the USERPROP file to the trash bin: "mv /etc/opt/OCMP/UserConfig.properties /home/trsh/backup/UserConfig.properties.back"&lt;BR /&gt;Then you send a single echo into the file, which is why sed doesn't complain that it can't find the file.&lt;BR /&gt;&lt;BR /&gt;So, you run the sed command against a basically empty file and generate a new basically empty file.  Unles I'm missing something.&lt;/SNIPPED&gt;</description>
      <pubDate>Wed, 06 Mar 2002 19:06:02 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/sed-nightmare/m-p/2677393#M907002</guid>
      <dc:creator>Alan Riggs</dc:creator>
      <dc:date>2002-03-06T19:06:02Z</dc:date>
    </item>
    <item>
      <title>Re: sed nightmare</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/sed-nightmare/m-p/2677394#M907003</link>
      <description>... guess I need to hand over the rabbit to Alan.&lt;BR /&gt;&lt;BR /&gt;Very good job Alan.&lt;BR /&gt;Volker</description>
      <pubDate>Wed, 06 Mar 2002 19:14:12 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/sed-nightmare/m-p/2677394#M907003</guid>
      <dc:creator>Volker Borowski</dc:creator>
      <dc:date>2002-03-06T19:14:12Z</dc:date>
    </item>
    <item>
      <title>Re: sed nightmare</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/sed-nightmare/m-p/2677395#M907004</link>
      <description>;)&lt;BR /&gt;&lt;BR /&gt;yea, that was a backup and restore function!&lt;BR /&gt;&lt;BR /&gt;heh!&lt;BR /&gt;&lt;BR /&gt;I changed it to cp... after which!!&lt;BR /&gt;&lt;BR /&gt;Thanks!&lt;BR /&gt;&lt;BR /&gt;Later,&lt;BR /&gt;Bill&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Wed, 06 Mar 2002 19:20:08 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/sed-nightmare/m-p/2677395#M907004</guid>
      <dc:creator>Bill McNAMARA_1</dc:creator>
      <dc:date>2002-03-06T19:20:08Z</dc:date>
    </item>
  </channel>
</rss>

