<?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: Chaning a string using sed giving parse error in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/chaning-a-string-using-sed-giving-parse-error/m-p/2890130#M819161</link>
    <description>Nah, I guess that either $e or $e0 contains a slash, making the sed command bogus.&lt;BR /&gt;&lt;BR /&gt;My first suggestion is to use double quotes to make the command more readable:&lt;BR /&gt;&lt;BR /&gt;sed -e "s/$e/$e0/g" $hm/dw &amp;gt;$hm/dw1&lt;BR /&gt;&lt;BR /&gt;to be more lenient to the pattern, use perl's alternate syntax for s///, that would catch this:&lt;BR /&gt;&lt;BR /&gt;perl -pe "s{$e}{$e0}g" $hm/dw &amp;gt;$hm/dw1&lt;BR /&gt;&lt;BR /&gt;Enjoy, have FUN! H.Merijn</description>
    <pubDate>Fri, 24 Jan 2003 11:28:51 GMT</pubDate>
    <dc:creator>H.Merijn Brand (procura</dc:creator>
    <dc:date>2003-01-24T11:28:51Z</dc:date>
    <item>
      <title>Chaning a string using sed giving parse error</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/chaning-a-string-using-sed-giving-parse-error/m-p/2890128#M819159</link>
      <description>Hi,&lt;BR /&gt;I'm trying to chg a string in a file with another string within a loop, but am getting a parse error on the sed operation :&lt;BR /&gt;&lt;BR /&gt;for e in `cat $hm/l1`&lt;BR /&gt;do&lt;BR /&gt; e0=`$hm/i1 $e`&lt;BR /&gt; sed -e 's/'$e'/'$e0'/g' $hm/dw &amp;gt; $hm/dw1&lt;BR /&gt;done&lt;BR /&gt;&lt;BR /&gt;Error is&lt;BR /&gt;sed: Function s/030113/ Mon cannot be parsed.&lt;BR /&gt;sed: Function s/030114/ Tue cannot be parsed.&lt;BR /&gt;&lt;BR /&gt;where file l1 contains&lt;BR /&gt;030113&lt;BR /&gt;030114&lt;BR /&gt;and job i1 returns a day&lt;BR /&gt;&lt;BR /&gt;Any ideas - Appologies if it's something obvious&lt;BR /&gt;&lt;BR /&gt;Enda&lt;BR /&gt;</description>
      <pubDate>Fri, 24 Jan 2003 10:46:23 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/chaning-a-string-using-sed-giving-parse-error/m-p/2890128#M819159</guid>
      <dc:creator>Enda Martin_1</dc:creator>
      <dc:date>2003-01-24T10:46:23Z</dc:date>
    </item>
    <item>
      <title>Re: Chaning a string using sed giving parse error</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/chaning-a-string-using-sed-giving-parse-error/m-p/2890129#M819160</link>
      <description>Looks like your "i1" jobs returns a trailing blank.&lt;BR /&gt;&lt;BR /&gt;Try this instead:&lt;BR /&gt;&lt;BR /&gt;$hm/i1 $e | read e0&lt;BR /&gt;&lt;BR /&gt;Best regards...&lt;BR /&gt; Dietmar.</description>
      <pubDate>Fri, 24 Jan 2003 11:17:50 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/chaning-a-string-using-sed-giving-parse-error/m-p/2890129#M819160</guid>
      <dc:creator>Dietmar Konermann</dc:creator>
      <dc:date>2003-01-24T11:17:50Z</dc:date>
    </item>
    <item>
      <title>Re: Chaning a string using sed giving parse error</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/chaning-a-string-using-sed-giving-parse-error/m-p/2890130#M819161</link>
      <description>Nah, I guess that either $e or $e0 contains a slash, making the sed command bogus.&lt;BR /&gt;&lt;BR /&gt;My first suggestion is to use double quotes to make the command more readable:&lt;BR /&gt;&lt;BR /&gt;sed -e "s/$e/$e0/g" $hm/dw &amp;gt;$hm/dw1&lt;BR /&gt;&lt;BR /&gt;to be more lenient to the pattern, use perl's alternate syntax for s///, that would catch this:&lt;BR /&gt;&lt;BR /&gt;perl -pe "s{$e}{$e0}g" $hm/dw &amp;gt;$hm/dw1&lt;BR /&gt;&lt;BR /&gt;Enjoy, have FUN! H.Merijn</description>
      <pubDate>Fri, 24 Jan 2003 11:28:51 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/chaning-a-string-using-sed-giving-parse-error/m-p/2890130#M819161</guid>
      <dc:creator>H.Merijn Brand (procura</dc:creator>
      <dc:date>2003-01-24T11:28:51Z</dc:date>
    </item>
    <item>
      <title>Re: Chaning a string using sed giving parse error</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/chaning-a-string-using-sed-giving-parse-error/m-p/2890131#M819162</link>
      <description>hi,&lt;BR /&gt;&lt;BR /&gt;Or perhaps i1 returns '/' characters ... You can use any character as a separator instead of /. Try for example ';' :&lt;BR /&gt;&lt;BR /&gt;sed -e 's;'$e';'$e0';g' $hm/dw &amp;gt; $hm/dw1&lt;BR /&gt;&lt;BR /&gt;Regards.</description>
      <pubDate>Fri, 24 Jan 2003 11:29:20 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/chaning-a-string-using-sed-giving-parse-error/m-p/2890131#M819162</guid>
      <dc:creator>Jean-Louis Phelix</dc:creator>
      <dc:date>2003-01-24T11:29:20Z</dc:date>
    </item>
    <item>
      <title>Re: Chaning a string using sed giving parse error</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/chaning-a-string-using-sed-giving-parse-error/m-p/2890132#M819163</link>
      <description>Dietmar,&lt;BR /&gt;thanks for that. This has lead me to another problem in that the second string 030114 converts ok but the first string 030113 doesn't convert at all...it's as if sed is ignoring the first loop(if I put in a grep to see if the correct strings are been used and are in the dw file everything looks ok)&lt;BR /&gt;&lt;BR /&gt;Cheers.</description>
      <pubDate>Fri, 24 Jan 2003 11:31:20 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/chaning-a-string-using-sed-giving-parse-error/m-p/2890132#M819163</guid>
      <dc:creator>Enda Martin_1</dc:creator>
      <dc:date>2003-01-24T11:31:20Z</dc:date>
    </item>
    <item>
      <title>Re: Chaning a string using sed giving parse error</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/chaning-a-string-using-sed-giving-parse-error/m-p/2890133#M819164</link>
      <description>Enda,&lt;BR /&gt;&lt;BR /&gt;It looks like if $hm is set before the loop, then $hm/dw and $hm/dw1 will be the same value for each iteration of the loop.&lt;BR /&gt;&lt;BR /&gt;Thus $hm/dw1 will have the last sed command run, which is your 030114. The 030113 is overwritten.&lt;BR /&gt;&lt;BR /&gt;HTH&lt;BR /&gt;&lt;BR /&gt;-- Rod Hills</description>
      <pubDate>Fri, 24 Jan 2003 15:30:28 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/chaning-a-string-using-sed-giving-parse-error/m-p/2890133#M819164</guid>
      <dc:creator>Rodney Hills</dc:creator>
      <dc:date>2003-01-24T15:30:28Z</dc:date>
    </item>
    <item>
      <title>Re: Chaning a string using sed giving parse error</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/chaning-a-string-using-sed-giving-parse-error/m-p/2890134#M819165</link>
      <description>If you are trying to do multiple changes to a file with sed, then put the s/// commands in a file and use:&lt;BR /&gt;&lt;BR /&gt;sed -f myfile $hm/dw &amp;gt; $hm/dw1&lt;BR /&gt;&lt;BR /&gt;This would require building "myfile" with s/// commands from your $hm/l1 file.&lt;BR /&gt;&lt;BR /&gt;If you used perl, then you could do something like&lt;BR /&gt;&lt;BR /&gt;perl -en '$hm=ENV{"hm"};$x=`$hm/i1 $_`; print "s/$_/$x/g\n";}' $hm/l1 &amp;gt;myfile&lt;BR /&gt;&lt;BR /&gt;to create "myfile".&lt;BR /&gt;&lt;BR /&gt;But if you used perl, you could do it with using "sed".&lt;BR /&gt;&lt;BR /&gt;HTH&lt;BR /&gt;&lt;BR /&gt;-- Rod Hills</description>
      <pubDate>Fri, 24 Jan 2003 15:48:29 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/chaning-a-string-using-sed-giving-parse-error/m-p/2890134#M819165</guid>
      <dc:creator>Rodney Hills</dc:creator>
      <dc:date>2003-01-24T15:48:29Z</dc:date>
    </item>
    <item>
      <title>Re: Chaning a string using sed giving parse error</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/chaning-a-string-using-sed-giving-parse-error/m-p/2890135#M819166</link>
      <description>Rodney, I hope you ment&lt;BR /&gt;&lt;BR /&gt;perl -en '$hm=ENV{hm};chomp($x=`$hm/i1 $_`); print "s/$_/$x/g\n";}' $hm/l1 &amp;gt;myfile&lt;BR /&gt;&lt;BR /&gt;backticks are not (yet) autochomped</description>
      <pubDate>Fri, 24 Jan 2003 16:38:10 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/chaning-a-string-using-sed-giving-parse-error/m-p/2890135#M819166</guid>
      <dc:creator>H.Merijn Brand (procura</dc:creator>
      <dc:date>2003-01-24T16:38:10Z</dc:date>
    </item>
    <item>
      <title>Re: Chaning a string using sed giving parse error</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/chaning-a-string-using-sed-giving-parse-error/m-p/2890136#M819167</link>
      <description>I'm bad about chomp's sometime, especially on the one-liners. Thanks for keeping me on my toes.&lt;BR /&gt;&lt;BR /&gt;-- Rod Hills</description>
      <pubDate>Fri, 24 Jan 2003 21:17:06 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/chaning-a-string-using-sed-giving-parse-error/m-p/2890136#M819167</guid>
      <dc:creator>Rodney Hills</dc:creator>
      <dc:date>2003-01-24T21:17:06Z</dc:date>
    </item>
  </channel>
</rss>

