<?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 with read input in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/sed-with-read-input/m-p/4465627#M360438</link>
    <description>Shalom,&lt;BR /&gt;&lt;BR /&gt;Sed examples.&lt;BR /&gt;&lt;BR /&gt;$commandline = "sed s/juf.org/juf.net/g ${filetoback} &amp;gt; $filetoback.bck";&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;      system("${commandline}");&lt;BR /&gt;      $commandline = "cp ${filetoback}.bck ${filetoback}";&lt;BR /&gt;      system("${commandline}");&lt;BR /&gt;&lt;BR /&gt;This is pulled from a perl script that goes to the command shell to do some sed conversion.&lt;BR /&gt;&lt;BR /&gt;Pretend the perl part isn't around.&lt;BR /&gt;&lt;BR /&gt;the cp command copies the output of the sed command over the original data file.&lt;BR /&gt;&lt;BR /&gt;SEP&lt;BR /&gt;&lt;BR /&gt;</description>
    <pubDate>Thu, 23 Jul 2009 13:15:42 GMT</pubDate>
    <dc:creator>Steven E. Protter</dc:creator>
    <dc:date>2009-07-23T13:15:42Z</dc:date>
    <item>
      <title>sed with read input</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/sed-with-read-input/m-p/4465626#M360437</link>
      <description>problem with shell scripting:&lt;BR /&gt;The sed command doesn't work.. Do you know what is the correct syntax of sed command?&lt;BR /&gt;I want to change the IP-address of the APN.&lt;BR /&gt;&lt;BR /&gt;Many thanks.&lt;BR /&gt;&lt;BR /&gt;John&lt;BR /&gt;&lt;BR /&gt;#!/bin/sh&lt;BR /&gt;&lt;BR /&gt;  printf "Which APN you want to migrate?  "&lt;BR /&gt;  read APN&lt;BR /&gt;  printf "\n\n"&lt;BR /&gt;  printf "You want to migrate this APN: $APN"&lt;BR /&gt;  printf "\n\n"&lt;BR /&gt;  printf "Current IP of this APN: $APN"&lt;BR /&gt;  printf "\n\n"&lt;BR /&gt;     cat gprs.zone | grep "$APN"&lt;BR /&gt;     printf "\n\n"&lt;BR /&gt;     printf "\n\n"&lt;BR /&gt;     sed '/$APN/s/10.10.10.12/10.10.10.225/g' gprs.zone &amp;gt; gprs.zone.new&lt;BR /&gt;     sed '/$APN/s/10.10.10.40/10.10.10.229/g' gprs.zone &amp;gt; gprs.zone.new&lt;BR /&gt;     printf "result"&lt;BR /&gt;     printf "\n\n"&lt;BR /&gt;     cat gprs.zone.new | grep "$APN"&lt;BR /&gt;     exit&lt;BR /&gt;&lt;BR /&gt;Printout of the shell script.&lt;BR /&gt;***********************************************&lt;BR /&gt;&lt;BR /&gt;Which APN you want to migrate?  test.com&lt;BR /&gt;&lt;BR /&gt;You want to migrate this APN: test.com&lt;BR /&gt;&lt;BR /&gt;Current IP of this APN: test.com&lt;BR /&gt;&lt;BR /&gt;test.com               IN      A       10.10.10.40&lt;BR /&gt;test.com               IN      A       10.10.10.12&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;result&lt;BR /&gt;&lt;BR /&gt;test.com               IN      A       10.10.10.40&lt;BR /&gt;test.com               IN      A       10.10.10.12&lt;BR /&gt;&lt;BR /&gt;***********************************************</description>
      <pubDate>Thu, 23 Jul 2009 13:09:29 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/sed-with-read-input/m-p/4465626#M360437</guid>
      <dc:creator>johnho</dc:creator>
      <dc:date>2009-07-23T13:09:29Z</dc:date>
    </item>
    <item>
      <title>Re: sed with read input</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/sed-with-read-input/m-p/4465627#M360438</link>
      <description>Shalom,&lt;BR /&gt;&lt;BR /&gt;Sed examples.&lt;BR /&gt;&lt;BR /&gt;$commandline = "sed s/juf.org/juf.net/g ${filetoback} &amp;gt; $filetoback.bck";&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;      system("${commandline}");&lt;BR /&gt;      $commandline = "cp ${filetoback}.bck ${filetoback}";&lt;BR /&gt;      system("${commandline}");&lt;BR /&gt;&lt;BR /&gt;This is pulled from a perl script that goes to the command shell to do some sed conversion.&lt;BR /&gt;&lt;BR /&gt;Pretend the perl part isn't around.&lt;BR /&gt;&lt;BR /&gt;the cp command copies the output of the sed command over the original data file.&lt;BR /&gt;&lt;BR /&gt;SEP&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Thu, 23 Jul 2009 13:15:42 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/sed-with-read-input/m-p/4465627#M360438</guid>
      <dc:creator>Steven E. Protter</dc:creator>
      <dc:date>2009-07-23T13:15:42Z</dc:date>
    </item>
    <item>
      <title>Re: sed with read input</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/sed-with-read-input/m-p/4465628#M360439</link>
      <description>have you tried:&lt;BR /&gt;&lt;BR /&gt;cat gprs.zone | sed '/$APN/s/10.10.10.12/10.10.10.225/g'  &amp;gt; gprs.zone.new&lt;BR /&gt;&lt;BR /&gt;yet ?</description>
      <pubDate>Thu, 23 Jul 2009 13:17:07 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/sed-with-read-input/m-p/4465628#M360439</guid>
      <dc:creator>Mel Burslan</dc:creator>
      <dc:date>2009-07-23T13:17:07Z</dc:date>
    </item>
    <item>
      <title>Re: sed with read input</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/sed-with-read-input/m-p/4465629#M360440</link>
      <description>Hi:&lt;BR /&gt;&lt;BR /&gt;Using:&lt;BR /&gt;&lt;BR /&gt;# sed '/$APN/s/10.10.10.40/10.10.10.229/g' &lt;BR /&gt;&lt;BR /&gt;...with the single quotes is not going to allow interpolation of your APN variable.  Instead use:&lt;BR /&gt;&lt;BR /&gt;# sed "/$APN/s/10.10.10.40/10.10.10.229/g" &lt;BR /&gt;&lt;BR /&gt;Regards!&lt;BR /&gt;&lt;BR /&gt;...JRF...&lt;BR /&gt;</description>
      <pubDate>Thu, 23 Jul 2009 13:38:46 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/sed-with-read-input/m-p/4465629#M360440</guid>
      <dc:creator>James R. Ferguson</dc:creator>
      <dc:date>2009-07-23T13:38:46Z</dc:date>
    </item>
    <item>
      <title>Re: sed with read input</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/sed-with-read-input/m-p/4465630#M360441</link>
      <description>#!/bin/sh&lt;BR /&gt;&lt;BR /&gt;  printf "Which APN you want to migrate?  "&lt;BR /&gt;  read APN&lt;BR /&gt;  printf "\n\n"&lt;BR /&gt;  printf "You want to migrate this APN: $APN"&lt;BR /&gt;  printf "\n\n"&lt;BR /&gt;  printf "Current IP of this APN: $APN"&lt;BR /&gt;  printf "\n\n"&lt;BR /&gt;     cat gprs.zone | grep "$APN"&lt;BR /&gt;     printf "\n\n"&lt;BR /&gt;     printf "\n\n"&lt;BR /&gt;&lt;BR /&gt;     sed "/$APN/s/10.10.10.12/10.10.10.225/g" gprs.zone &amp;gt; gprs.zone.new&lt;BR /&gt;     sed "/$APN/s/10.10.10.40/10.10.10.229/g" gprs.zone &amp;gt; gprs.zone.new&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;     printf "result"&lt;BR /&gt;     printf "\n\n"&lt;BR /&gt;     cat gprs.zone.new | grep "$APN"&lt;BR /&gt;     exit&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Result of the script:&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Which APN you want to migrate?  test.com&lt;BR /&gt;&lt;BR /&gt;You want to migrate this APN: test.com&lt;BR /&gt;&lt;BR /&gt;Current IP of this APN: test.com&lt;BR /&gt;&lt;BR /&gt;test.com               IN      A       10.10.10.40&lt;BR /&gt;test.com               IN      A       10.10.10.12&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;result&lt;BR /&gt;&lt;BR /&gt;test.com               IN      A       10.10.10.229&lt;BR /&gt;test.com               IN      A       10.10.10.12&lt;BR /&gt;&lt;BR /&gt;It is better now but still not 100%.&lt;BR /&gt;Problem now is: the second IP-address is not changed... do I need to do for or while loop?&lt;BR /&gt;&lt;BR /&gt;Best regards,&lt;BR /&gt;&lt;BR /&gt;John&lt;BR /&gt;</description>
      <pubDate>Thu, 23 Jul 2009 14:05:21 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/sed-with-read-input/m-p/4465630#M360441</guid>
      <dc:creator>johnho</dc:creator>
      <dc:date>2009-07-23T14:05:21Z</dc:date>
    </item>
    <item>
      <title>Re: sed with read input</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/sed-with-read-input/m-p/4465631#M360442</link>
      <description>Hi (again) John:&lt;BR /&gt;&lt;BR /&gt;&amp;gt; Problem now is: the second IP-address is not changed... do I need to do for or while loop?&lt;BR /&gt;&lt;BR /&gt;Yes, you overwrote your output when you did the second substitution!&lt;BR /&gt;&lt;BR /&gt;# sed -e "/$APN/s/10.10.10.12/10.10.10.225/g" -e "/$APN/s/10.10.10.40/10.10.10.229/g" gprs.zone &amp;gt; gprs.zone.new&lt;BR /&gt;&lt;BR /&gt;...will fix your problem.&lt;BR /&gt;&lt;BR /&gt;Regards!&lt;BR /&gt;&lt;BR /&gt;...JRF...</description>
      <pubDate>Thu, 23 Jul 2009 14:16:55 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/sed-with-read-input/m-p/4465631#M360442</guid>
      <dc:creator>James R. Ferguson</dc:creator>
      <dc:date>2009-07-23T14:16:55Z</dc:date>
    </item>
    <item>
      <title>Re: sed with read input</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/sed-with-read-input/m-p/4465632#M360443</link>
      <description>The funny thing is that sed won't work for the last line in a file, as the last line doesn't have a carriage return in its end. (such as \n or \r)</description>
      <pubDate>Thu, 23 Jul 2009 14:34:55 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/sed-with-read-input/m-p/4465632#M360443</guid>
      <dc:creator>Tingli</dc:creator>
      <dc:date>2009-07-23T14:34:55Z</dc:date>
    </item>
    <item>
      <title>Re: sed with read input</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/sed-with-read-input/m-p/4465633#M360444</link>
      <description>&amp;gt;sed '/$APN/s/10.10.10.12/10.10.10.225/g'&lt;BR /&gt;&lt;BR /&gt;To be pedantic, you should quote each ".":&lt;BR /&gt;sed /$APN/s/'10\.10\.10\.12/10.10.10.225/g'&lt;BR /&gt;&lt;BR /&gt;&amp;gt;Tingli: The funny thing is that sed won't work for the last line in a file, as the last line doesn't have a newline in its end.&lt;BR /&gt;&lt;BR /&gt;That's way it is suppose to work.  sed only works on text files and lines must be terminated by a newline.&lt;BR /&gt;&lt;A href="http://docs.hp.com/en/B2355-60130/glossary.9.html#d0e1257203" target="_blank"&gt;http://docs.hp.com/en/B2355-60130/glossary.9.html#d0e1257203&lt;/A&gt;</description>
      <pubDate>Fri, 24 Jul 2009 08:56:30 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/sed-with-read-input/m-p/4465633#M360444</guid>
      <dc:creator>Dennis Handly</dc:creator>
      <dc:date>2009-07-24T08:56:30Z</dc:date>
    </item>
  </channel>
</rss>

