<?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: problem with sed command in Operating System - Linux</title>
    <link>https://community.hpe.com/t5/operating-system-linux/problem-with-sed-command/m-p/3783147#M99407</link>
    <description>Hi,&lt;BR /&gt;&lt;BR /&gt;your escapes via \ mus be doubled, if processing of the string is doubled:&lt;BR /&gt;in a plain echo '\\', in an execution in `` you have to use '\\\\'. As a side effect, echo may recognize character special sequences ('\n') you not intend to be performed.&lt;BR /&gt;&lt;BR /&gt;You can do this assignment nearly without esacaping:&lt;BR /&gt;&lt;BR /&gt;echo /OPT/LOYAN/LOADING/DATA_TEMP/UPC_REJECT|sed 's:/:\\:g' | read UPC_REJECT&lt;BR /&gt;&lt;BR /&gt;mfG Peter</description>
    <pubDate>Fri, 05 May 2006 02:57:49 GMT</pubDate>
    <dc:creator>Peter Nikitka</dc:creator>
    <dc:date>2006-05-05T02:57:49Z</dc:date>
    <item>
      <title>problem with sed command</title>
      <link>https://community.hpe.com/t5/operating-system-linux/problem-with-sed-command/m-p/3783141#M99401</link>
      <description>&lt;P&gt;I am facing the problem with the sed on my server.&lt;BR /&gt;&lt;BR /&gt;My requirement is to change the filename in the ssort and awk scripts to point to the correct directory. To change the directory I need to delimit the “/” so as to have it “\/” in the variable to be successful with the sed.&lt;BR /&gt;&lt;BR /&gt;The limitation with the ssort is it will not accept the second occurrence of the /INFILE as a variable (like /INFILE $1)&lt;BR /&gt;&lt;BR /&gt;So we have to use the sed to replace the FILE_NAME after the /INFILE to point to the correct directory.&lt;BR /&gt;&lt;BR /&gt;At the time of testing the sed is giving the problem.&lt;BR /&gt;&lt;BR /&gt;It is successful with the command (2), but with the tilda(`) to assign it to variable it is giving the below error, command (3).&lt;BR /&gt;&lt;BR /&gt;1) $ FINAL_MANUF=/apps/aloyan/loading/data;export FINAL_MANUF&lt;BR /&gt;&lt;BR /&gt;2) $ echo $FINAL_MANUF|sed 's/\//\\\//g'&lt;BR /&gt;&lt;BR /&gt;\/apps\/aloyan\/loading\/data&lt;BR /&gt;&lt;BR /&gt;3) $ UPC_REJECT=`echo /OPT/LOYAN/LOADING/DATA_TEMP/UPC_REJECT|sed 's/\//\\\//g'`&lt;BR /&gt;&lt;BR /&gt;sed: Function s/\//\\//g cannot be parsed.&lt;BR /&gt;&lt;BR /&gt; &lt;BR /&gt;&lt;BR /&gt;is it a problem with the sed?&lt;BR /&gt;i tried with "sed" command with its full path "/usr/bin/sed", still I am getting the same error:&lt;BR /&gt;sed: Function s/\//\\//g cannot be parsed.&lt;BR /&gt;&lt;BR /&gt;please suggest&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;P.S.This thread has been moved from HP-UX&amp;gt;System Administration to HP-UX &amp;gt; &amp;nbsp;langages- HP Forums Moderator&lt;/P&gt;</description>
      <pubDate>Mon, 14 Jan 2013 04:26:40 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/problem-with-sed-command/m-p/3783141#M99401</guid>
      <dc:creator>praveen..</dc:creator>
      <dc:date>2013-01-14T04:26:40Z</dc:date>
    </item>
    <item>
      <title>Re: problem with sed command</title>
      <link>https://community.hpe.com/t5/operating-system-linux/problem-with-sed-command/m-p/3783142#M99402</link>
      <description>How about plain tr?&lt;BR /&gt;&lt;BR /&gt;echo "/apps/aloyan/loading/data" | tr '\/' '\\' gives&lt;BR /&gt;&lt;BR /&gt;\apps\aloyan\loading\data</description>
      <pubDate>Fri, 05 May 2006 01:54:09 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/problem-with-sed-command/m-p/3783142#M99402</guid>
      <dc:creator>RAC_1</dc:creator>
      <dc:date>2006-05-05T01:54:09Z</dc:date>
    </item>
    <item>
      <title>Re: problem with sed command</title>
      <link>https://community.hpe.com/t5/operating-system-linux/problem-with-sed-command/m-p/3783143#M99403</link>
      <description>Hello, &lt;BR /&gt;&lt;BR /&gt;Why not this, &lt;BR /&gt;&lt;BR /&gt;#echo "/apps/aloyan/loading/data" |sed 's/\/\\//g'&lt;BR /&gt;/apps/aloyan/loading/data&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;-Arun</description>
      <pubDate>Fri, 05 May 2006 01:57:32 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/problem-with-sed-command/m-p/3783143#M99403</guid>
      <dc:creator>Arunvijai_4</dc:creator>
      <dc:date>2006-05-05T01:57:32Z</dc:date>
    </item>
    <item>
      <title>Re: problem with sed command</title>
      <link>https://community.hpe.com/t5/operating-system-linux/problem-with-sed-command/m-p/3783144#M99404</link>
      <description>$ FINAL_MANUF=/apps/aloyan/loading/data;export FINAL_MANUF&lt;BR /&gt;$ echo $FINAL_MANUF|sed 's/\//\\/g'&lt;BR /&gt;\apps\aloyan\loading\data&lt;BR /&gt;&lt;BR /&gt;$ UPC_REJECT=`echo /OPT/LOYAN/LOADING/DATA_TEMP/UPC_REJECT|sed 's/\//\\\/g'`&lt;BR /&gt;$ echo $UPC_REJECT&lt;BR /&gt;\OPT\LOYAN\LOADING\DATA_TEMP\UPC_REJECT&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Fri, 05 May 2006 02:03:42 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/problem-with-sed-command/m-p/3783144#M99404</guid>
      <dc:creator>Jannik</dc:creator>
      <dc:date>2006-05-05T02:03:42Z</dc:date>
    </item>
    <item>
      <title>Re: problem with sed command</title>
      <link>https://community.hpe.com/t5/operating-system-linux/problem-with-sed-command/m-p/3783145#M99405</link>
      <description>is this scripts related problem or "sed" command related problem?&lt;BR /&gt;&lt;BR /&gt;how to resolve this?&lt;BR /&gt;</description>
      <pubDate>Fri, 05 May 2006 02:38:18 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/problem-with-sed-command/m-p/3783145#M99405</guid>
      <dc:creator>praveen..</dc:creator>
      <dc:date>2006-05-05T02:38:18Z</dc:date>
    </item>
    <item>
      <title>Re: problem with sed command</title>
      <link>https://community.hpe.com/t5/operating-system-linux/problem-with-sed-command/m-p/3783146#M99406</link>
      <description>Hi, &lt;BR /&gt;&lt;BR /&gt;This is a script problem with usage of sed. Not a problem with "sed". &lt;BR /&gt;&lt;BR /&gt;-Arun &lt;BR /&gt;</description>
      <pubDate>Fri, 05 May 2006 02:51:40 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/problem-with-sed-command/m-p/3783146#M99406</guid>
      <dc:creator>Arunvijai_4</dc:creator>
      <dc:date>2006-05-05T02:51:40Z</dc:date>
    </item>
    <item>
      <title>Re: problem with sed command</title>
      <link>https://community.hpe.com/t5/operating-system-linux/problem-with-sed-command/m-p/3783147#M99407</link>
      <description>Hi,&lt;BR /&gt;&lt;BR /&gt;your escapes via \ mus be doubled, if processing of the string is doubled:&lt;BR /&gt;in a plain echo '\\', in an execution in `` you have to use '\\\\'. As a side effect, echo may recognize character special sequences ('\n') you not intend to be performed.&lt;BR /&gt;&lt;BR /&gt;You can do this assignment nearly without esacaping:&lt;BR /&gt;&lt;BR /&gt;echo /OPT/LOYAN/LOADING/DATA_TEMP/UPC_REJECT|sed 's:/:\\:g' | read UPC_REJECT&lt;BR /&gt;&lt;BR /&gt;mfG Peter</description>
      <pubDate>Fri, 05 May 2006 02:57:49 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/problem-with-sed-command/m-p/3783147#M99407</guid>
      <dc:creator>Peter Nikitka</dc:creator>
      <dc:date>2006-05-05T02:57:49Z</dc:date>
    </item>
    <item>
      <title>Re: problem with sed command</title>
      <link>https://community.hpe.com/t5/operating-system-linux/problem-with-sed-command/m-p/3783148#M99408</link>
      <description>Hi,&lt;BR /&gt;I am able to get the correct output when i use the command on $ sign.&lt;BR /&gt;&lt;BR /&gt;but when i create a script with the same command, it is giving the error.&lt;BR /&gt;sed: Function s/\//\\//g cannot be parsed.&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;i have changed this file permission to 777&lt;BR /&gt;&lt;BR /&gt;please suggest what to do.</description>
      <pubDate>Fri, 05 May 2006 04:06:27 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/problem-with-sed-command/m-p/3783148#M99408</guid>
      <dc:creator>praveen..</dc:creator>
      <dc:date>2006-05-05T04:06:27Z</dc:date>
    </item>
    <item>
      <title>Re: problem with sed command</title>
      <link>https://community.hpe.com/t5/operating-system-linux/problem-with-sed-command/m-p/3783149#M99409</link>
      <description>Hi,&lt;BR /&gt;&lt;BR /&gt;using my approach in a script (ksh, posix-shell) worked for me - which shell do you use in your script?&lt;BR /&gt;&lt;BR /&gt;mfG Peter</description>
      <pubDate>Fri, 05 May 2006 04:09:42 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/problem-with-sed-command/m-p/3783149#M99409</guid>
      <dc:creator>Peter Nikitka</dc:creator>
      <dc:date>2006-05-05T04:09:42Z</dc:date>
    </item>
    <item>
      <title>Re: problem with sed command</title>
      <link>https://community.hpe.com/t5/operating-system-linux/problem-with-sed-command/m-p/3783150#M99410</link>
      <description>I am using "ksh" shell</description>
      <pubDate>Fri, 05 May 2006 04:11:54 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/problem-with-sed-command/m-p/3783150#M99410</guid>
      <dc:creator>praveen..</dc:creator>
      <dc:date>2006-05-05T04:11:54Z</dc:date>
    </item>
    <item>
      <title>Re: problem with sed command</title>
      <link>https://community.hpe.com/t5/operating-system-linux/problem-with-sed-command/m-p/3783151#M99411</link>
      <description>Hi,&lt;BR /&gt;&lt;BR /&gt;I think you did not change the vaiable assignment to this way in your script&lt;BR /&gt;&lt;BR /&gt;echo /OPT/LOYAN/LOADING/DATA_TEMP/UPC_REJECT|sed 's:/:\\:g' | read UPC_REJECT&lt;BR /&gt;&lt;BR /&gt;since then your original error message would not occure.&lt;BR /&gt;Run your script via&lt;BR /&gt;ksh -x scriptname&lt;BR /&gt;or part of it with set +x enabled before the sed call(s).&lt;BR /&gt;&lt;BR /&gt;mfG Peter</description>
      <pubDate>Fri, 05 May 2006 04:50:32 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/problem-with-sed-command/m-p/3783151#M99411</guid>
      <dc:creator>Peter Nikitka</dc:creator>
      <dc:date>2006-05-05T04:50:32Z</dc:date>
    </item>
    <item>
      <title>Re: problem with sed command</title>
      <link>https://community.hpe.com/t5/operating-system-linux/problem-with-sed-command/m-p/3783152#M99412</link>
      <description>Hi,&lt;BR /&gt;&lt;BR /&gt;I think you did not change the variable assignment to this way in your script&lt;BR /&gt;&lt;BR /&gt;echo /OPT/LOYAN/LOADING/DATA_TEMP/UPC_REJECT|sed 's:/:\\:g' | read UPC_REJECT&lt;BR /&gt;&lt;BR /&gt;since then your original error message would not occure.&lt;BR /&gt;Run your script via&lt;BR /&gt;ksh -x scriptname&lt;BR /&gt;or part of it with set +x enabled before the sed call(s).&lt;BR /&gt;&lt;BR /&gt;mfG Peter</description>
      <pubDate>Fri, 05 May 2006 04:50:56 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/problem-with-sed-command/m-p/3783152#M99412</guid>
      <dc:creator>Peter Nikitka</dc:creator>
      <dc:date>2006-05-05T04:50:56Z</dc:date>
    </item>
  </channel>
</rss>

