<?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: Shell Scripting Help .. Please Help in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/shell-scripting-help-please-help/m-p/3058341#M719210</link>
    <description>hi,&lt;BR /&gt;try to give a space before the value being tested in every "test" command. &lt;BR /&gt;Ex:instead of if [$end -gt $start] or while [$end -ge $start], please use if [ $end -gt $start ], while [ $end -ge $start ].&lt;BR /&gt;Regards.&lt;BR /&gt;ALPER ONEY&lt;BR /&gt;&lt;BR /&gt;</description>
    <pubDate>Thu, 28 Aug 2003 05:10:36 GMT</pubDate>
    <dc:creator>ALPER ONEY</dc:creator>
    <dc:date>2003-08-28T05:10:36Z</dc:date>
    <item>
      <title>Shell Scripting Help .. Please Help</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/shell-scripting-help-please-help/m-p/3058335#M719204</link>
      <description>Hi All,&lt;BR /&gt;I am trying write a shell script to accomplish following:&lt;BR /&gt;&lt;BR /&gt;This is what I want:&lt;BR /&gt;I have a file1 with following content:&lt;BR /&gt;xxx1 100 105&lt;BR /&gt;xxx2 200 210&lt;BR /&gt;xxx3 150 175&lt;BR /&gt;&lt;BR /&gt;For each line of this file, I need to genearte a new file with contenats and file name&lt;BR /&gt;in the pattern:&lt;BR /&gt;&lt;BR /&gt;file: xxx1.bif&lt;BR /&gt;&lt;A href="http://yyy.com/test.cgi?cmd=item-100&amp;amp;group=xxx1" target="_blank"&gt;http://yyy.com/test.cgi?cmd=item-100&amp;amp;group=xxx1&lt;/A&gt;&lt;BR /&gt;&lt;A href="http://yyy.com/test.cgi?cmd=item-101&amp;amp;group=xxx1" target="_blank"&gt;http://yyy.com/test.cgi?cmd=item-101&amp;amp;group=xxx1&lt;/A&gt;&lt;BR /&gt;..&lt;BR /&gt;..&lt;BR /&gt;&lt;A href="http://yyy.com/test.cgi?cmd=item-105&amp;amp;group=xxx1" target="_blank"&gt;http://yyy.com/test.cgi?cmd=item-105&amp;amp;group=xxx1&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;file: xxx2.bif&lt;BR /&gt;&lt;A href="http://yyy.com/test.cgi?cmd=item-200&amp;amp;group=xxx2" target="_blank"&gt;http://yyy.com/test.cgi?cmd=item-200&amp;amp;group=xxx2&lt;/A&gt;&lt;BR /&gt;&lt;A href="http://yyy.com/test.cgi?cmd=item-201&amp;amp;group=xxx2" target="_blank"&gt;http://yyy.com/test.cgi?cmd=item-201&amp;amp;group=xxx2&lt;/A&gt;&lt;BR /&gt;..&lt;BR /&gt;..&lt;BR /&gt;&lt;A href="http://yyy.com/test.cgi?cmd=item-210&amp;amp;group=xxx2" target="_blank"&gt;http://yyy.com/test.cgi?cmd=item-210&amp;amp;group=xxx2&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;I am trying following script and it doesn't work:&lt;BR /&gt;&lt;BR /&gt;infile=test.txt&lt;BR /&gt;url="&lt;A href="http://yyy.com/test.cgi?cmd=item-" target="_blank"&gt;http://yyy.com/test.cgi?cmd=item-&lt;/A&gt;"&lt;BR /&gt;uri="group="&lt;BR /&gt;suffix=".bif"&lt;BR /&gt;&lt;BR /&gt;cat $infile | while read name start end&lt;BR /&gt;do &lt;BR /&gt;  filename=`expr $name$suffix`&lt;BR /&gt;  if [$end -gt $start]&lt;BR /&gt;  then&lt;BR /&gt;    while [$end -ge $start]&lt;BR /&gt;    do&lt;BR /&gt;      echo $url$end$uri$name &amp;gt;&amp;gt; $filename&lt;BR /&gt;      echo "&amp;lt;&lt;EOD&gt;&amp;gt;" &amp;gt;&amp;gt; $filename&lt;BR /&gt;      end=`expr $end-1`&lt;BR /&gt;    done&lt;BR /&gt;  fi&lt;BR /&gt;&lt;BR /&gt;done &lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Any help is appreciated. The inner loop fails.&lt;BR /&gt;&lt;/EOD&gt;</description>
      <pubDate>Thu, 28 Aug 2003 02:10:53 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/shell-scripting-help-please-help/m-p/3058335#M719204</guid>
      <dc:creator>Praveen Hari</dc:creator>
      <dc:date>2003-08-28T02:10:53Z</dc:date>
    </item>
    <item>
      <title>Re: Shell Scripting Help .. Please Help</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/shell-scripting-help-please-help/m-p/3058336#M719205</link>
      <description>Whenever you say a script fails, provide the error message.  That way maybe someone can diagnose by site instead of having to copy the script and data and run the script.&lt;BR /&gt;&lt;BR /&gt;Not knowing the error code, I'll suggest this:&lt;BR /&gt;&lt;BR /&gt;change this:&lt;BR /&gt; echo $url$end$uri$name &amp;gt;&amp;gt; $filename &lt;BR /&gt;&lt;BR /&gt;to&lt;BR /&gt;&lt;BR /&gt; echo "${url} ${end} ${uri} ${name}" &amp;gt;&amp;gt; $filename &lt;BR /&gt;&lt;BR /&gt;The spaces may not be necessary.  If I can't sleep I'll actually try and run your script and debug it later.&lt;BR /&gt;&lt;BR /&gt;SEP&lt;BR /&gt;Will work for points.&lt;BR /&gt;</description>
      <pubDate>Thu, 28 Aug 2003 02:35:44 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/shell-scripting-help-please-help/m-p/3058336#M719205</guid>
      <dc:creator>Steven E. Protter</dc:creator>
      <dc:date>2003-08-28T02:35:44Z</dc:date>
    </item>
    <item>
      <title>Re: Shell Scripting Help .. Please Help</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/shell-scripting-help-please-help/m-p/3058337#M719206</link>
      <description>I tried changing it as you specified:&lt;BR /&gt;I get following message when I execute the script:&lt;BR /&gt;&lt;BR /&gt;./test.csh: [105: not found&lt;BR /&gt;./test.csh: [210: not found&lt;BR /&gt;./test.csh: [175: not found&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;I believe it may be due to some syntax error. But I am not able to figure out what it is...&lt;BR /&gt;Thanks&lt;BR /&gt;Praveen</description>
      <pubDate>Thu, 28 Aug 2003 04:02:43 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/shell-scripting-help-please-help/m-p/3058337#M719206</guid>
      <dc:creator>Praveen Hari</dc:creator>
      <dc:date>2003-08-28T04:02:43Z</dc:date>
    </item>
    <item>
      <title>Re: Shell Scripting Help .. Please Help</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/shell-scripting-help-please-help/m-p/3058338#M719207</link>
      <description>Problem seems to be lack of spaces in your expr.&lt;BR /&gt;&lt;BR /&gt;Assuming you don't mind the "&amp;lt;&lt;EOD&gt;&amp;gt;" after each entry in each file, the following works.&lt;BR /&gt;&lt;BR /&gt;infile=test.txt&lt;BR /&gt;url="&lt;A href="http://yyy.com/test.cgi?cmd=item-" target="_blank"&gt;http://yyy.com/test.cgi?cmd=item-&lt;/A&gt;"&lt;BR /&gt;uri="&amp;amp;group="&lt;BR /&gt;suffix=".bif"&lt;BR /&gt;&lt;BR /&gt;cat $infile | while read name start end&lt;BR /&gt;do&lt;BR /&gt; filename=`expr $name$suffix`&lt;BR /&gt; if [ $end -gt $start ]&lt;BR /&gt; then&lt;BR /&gt; while [ $end -ge $start ]&lt;BR /&gt; do&lt;BR /&gt; echo $url$end$uri$name &amp;gt;&amp;gt; $filename&lt;BR /&gt; echo "&amp;lt;&lt;EOD&gt;&amp;gt;" &amp;gt;&amp;gt; $filename&lt;BR /&gt; end=`expr $end - 1`&lt;BR /&gt; done&lt;BR /&gt; fi&lt;BR /&gt;&lt;BR /&gt;done&lt;BR /&gt;&lt;/EOD&gt;&lt;/EOD&gt;</description>
      <pubDate>Thu, 28 Aug 2003 04:43:08 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/shell-scripting-help-please-help/m-p/3058338#M719207</guid>
      <dc:creator>Mark Grant</dc:creator>
      <dc:date>2003-08-28T04:43:08Z</dc:date>
    </item>
    <item>
      <title>Re: Shell Scripting Help .. Please Help</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/shell-scripting-help-please-help/m-p/3058339#M719208</link>
      <description>Problem seems to be lack of spaces in your expr.&lt;BR /&gt;&lt;BR /&gt;Assuming you don't mind the "&amp;lt;&lt;EOD&gt;&amp;gt;" after each entry in each file, the following works.&lt;BR /&gt;&lt;BR /&gt;infile=test.txt&lt;BR /&gt;url="&lt;A href="http://yyy.com/test.cgi?cmd=item-" target="_blank"&gt;http://yyy.com/test.cgi?cmd=item-&lt;/A&gt;"&lt;BR /&gt;uri="&amp;amp;group="&lt;BR /&gt;suffix=".bif"&lt;BR /&gt;&lt;BR /&gt;cat $infile | while read name start end&lt;BR /&gt;do&lt;BR /&gt; filename=`expr $name$suffix`&lt;BR /&gt; if [ $end -gt $start ]&lt;BR /&gt; then&lt;BR /&gt; while [ $end -ge $start ]&lt;BR /&gt; do&lt;BR /&gt; echo $url$end$uri$name &amp;gt;&amp;gt; $filename&lt;BR /&gt; echo "&amp;lt;&lt;EOD&gt;&amp;gt;" &amp;gt;&amp;gt; $filename&lt;BR /&gt; end=`expr $end - 1`&lt;BR /&gt; done&lt;BR /&gt; fi&lt;BR /&gt;&lt;BR /&gt;done&lt;BR /&gt;&lt;/EOD&gt;&lt;/EOD&gt;</description>
      <pubDate>Thu, 28 Aug 2003 04:46:06 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/shell-scripting-help-please-help/m-p/3058339#M719208</guid>
      <dc:creator>Mark Grant</dc:creator>
      <dc:date>2003-08-28T04:46:06Z</dc:date>
    </item>
    <item>
      <title>Re: Shell Scripting Help .. Please Help</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/shell-scripting-help-please-help/m-p/3058340#M719209</link>
      <description>Problem seems to be lack of spaces in your expr.&lt;BR /&gt;&lt;BR /&gt;Assuming you don't mind the "&amp;lt;&lt;EOD&gt;&amp;gt;" after each entry in each file, the following works.&lt;BR /&gt;&lt;BR /&gt;infile=test.txt&lt;BR /&gt;url="&lt;A href="http://yyy.com/test.cgi?cmd=item-" target="_blank"&gt;http://yyy.com/test.cgi?cmd=item-&lt;/A&gt;"&lt;BR /&gt;uri="&amp;amp;group="&lt;BR /&gt;suffix=".bif"&lt;BR /&gt;&lt;BR /&gt;cat $infile | while read name start end&lt;BR /&gt;do&lt;BR /&gt; filename=`expr $name$suffix`&lt;BR /&gt; if [ $end -gt $start ]&lt;BR /&gt; then&lt;BR /&gt; while [ $end -ge $start ]&lt;BR /&gt; do&lt;BR /&gt; echo $url$end$uri$name &amp;gt;&amp;gt; $filename&lt;BR /&gt; echo "&amp;lt;&lt;EOD&gt;&amp;gt;" &amp;gt;&amp;gt; $filename&lt;BR /&gt; end=`expr $end - 1`&lt;BR /&gt; done&lt;BR /&gt; fi&lt;BR /&gt;&lt;BR /&gt;done&lt;BR /&gt;&lt;/EOD&gt;&lt;/EOD&gt;</description>
      <pubDate>Thu, 28 Aug 2003 04:46:39 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/shell-scripting-help-please-help/m-p/3058340#M719209</guid>
      <dc:creator>Mark Grant</dc:creator>
      <dc:date>2003-08-28T04:46:39Z</dc:date>
    </item>
    <item>
      <title>Re: Shell Scripting Help .. Please Help</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/shell-scripting-help-please-help/m-p/3058341#M719210</link>
      <description>hi,&lt;BR /&gt;try to give a space before the value being tested in every "test" command. &lt;BR /&gt;Ex:instead of if [$end -gt $start] or while [$end -ge $start], please use if [ $end -gt $start ], while [ $end -ge $start ].&lt;BR /&gt;Regards.&lt;BR /&gt;ALPER ONEY&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Thu, 28 Aug 2003 05:10:36 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/shell-scripting-help-please-help/m-p/3058341#M719210</guid>
      <dc:creator>ALPER ONEY</dc:creator>
      <dc:date>2003-08-28T05:10:36Z</dc:date>
    </item>
    <item>
      <title>Re: Shell Scripting Help .. Please Help</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/shell-scripting-help-please-help/m-p/3058342#M719211</link>
      <description>I think the inner loop fails because you re-assign the variable of the for, and at exit there is a big mess.&lt;BR /&gt;&lt;BR /&gt;try this:&lt;BR /&gt;&lt;BR /&gt;cat $infile | while read name start end&lt;BR /&gt;do&lt;BR /&gt;START=0&lt;BR /&gt;FINAL=0&lt;BR /&gt;filename=$name$suffix&lt;BR /&gt;if [$end -gt $start]&lt;BR /&gt;then&lt;BR /&gt;START=$start&lt;BR /&gt;FINAL=$end&lt;BR /&gt;while (($FINAL &amp;gt;= $START))&lt;BR /&gt;do&lt;BR /&gt;echo $url$START$uri$name &amp;gt;&amp;gt; $filename&lt;BR /&gt;echo "&amp;lt;&lt;EOD&gt;&amp;gt;" &amp;gt;&amp;gt; $filename&lt;BR /&gt;let START=START+1&lt;BR /&gt;done&lt;BR /&gt;fi&lt;BR /&gt;&lt;BR /&gt;done &lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;  Massimo&lt;/EOD&gt;</description>
      <pubDate>Thu, 28 Aug 2003 05:37:50 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/shell-scripting-help-please-help/m-p/3058342#M719211</guid>
      <dc:creator>Massimo Bianchi</dc:creator>
      <dc:date>2003-08-28T05:37:50Z</dc:date>
    </item>
    <item>
      <title>Re: Shell Scripting Help .. Please Help</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/shell-scripting-help-please-help/m-p/3058343#M719212</link>
      <description>Hi,&lt;BR /&gt;if you combine the advice given by Alper and Massimo, I think you should be there.&lt;BR /&gt;&lt;BR /&gt;regards,&lt;BR /&gt;John K.</description>
      <pubDate>Thu, 28 Aug 2003 06:15:43 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/shell-scripting-help-please-help/m-p/3058343#M719212</guid>
      <dc:creator>john korterman</dc:creator>
      <dc:date>2003-08-28T06:15:43Z</dc:date>
    </item>
    <item>
      <title>Re: Shell Scripting Help .. Please Help</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/shell-scripting-help-please-help/m-p/3058344#M719213</link>
      <description>Here is a short script that uses a perl 1-liner to do what you want.&lt;BR /&gt;&lt;BR /&gt;#!/usr/bin/sh&lt;BR /&gt;for $file in file* ; do&lt;BR /&gt;perl -ane 'print "&lt;A href="http://yyy.com/test.cgi?cmd=item-$_" target="_blank"&gt;http://yyy.com/test.cgi?cmd=item-$_&lt;/A&gt;\&amp;amp;group=$F[0]\n" foreach ($F[1]..$F[2])' $file &amp;gt;${file}.bif&lt;BR /&gt;done&lt;BR /&gt;&lt;BR /&gt;perl is handy for breaking up text and generating other data.&lt;BR /&gt;&lt;BR /&gt;HTH&lt;BR /&gt;&lt;BR /&gt;-- Rod Hills</description>
      <pubDate>Thu, 28 Aug 2003 13:51:44 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/shell-scripting-help-please-help/m-p/3058344#M719213</guid>
      <dc:creator>Rodney Hills</dc:creator>
      <dc:date>2003-08-28T13:51:44Z</dc:date>
    </item>
    <item>
      <title>Re: Shell Scripting Help .. Please Help</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/shell-scripting-help-please-help/m-p/3058345#M719214</link>
      <description>Mark,Alpher,MAssimo,&lt;BR /&gt;&lt;BR /&gt;Your all suggestions worked.&lt;BR /&gt;Rodney, I haven't tried Perl. I will try.&lt;BR /&gt;&lt;BR /&gt;Thanks all for quick answers.&lt;BR /&gt;I like this forum.&lt;BR /&gt;&lt;BR /&gt;Praveen</description>
      <pubDate>Thu, 28 Aug 2003 14:46:46 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/shell-scripting-help-please-help/m-p/3058345#M719214</guid>
      <dc:creator>Praveen Hari</dc:creator>
      <dc:date>2003-08-28T14:46:46Z</dc:date>
    </item>
  </channel>
</rss>

