<?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 script help in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/shell-script-help/m-p/4909389#M405863</link>
    <description>Here's one with just the cut command:&lt;BR /&gt;&lt;BR /&gt;$ echo arpt_356789.dbf | cut -f2 -d"_" | cut -f1 -d"."&lt;BR /&gt;356789&lt;BR /&gt;$&lt;BR /&gt;</description>
    <pubDate>Tue, 28 Jun 2005 08:33:16 GMT</pubDate>
    <dc:creator>Seth Parker</dc:creator>
    <dc:date>2005-06-28T08:33:16Z</dc:date>
    <item>
      <title>shell script help</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/shell-script-help/m-p/4909378#M405852</link>
      <description>hi gurus,&lt;BR /&gt;&lt;BR /&gt;i am writing a shell script, where i have got some doubts, can somebody clear me..&lt;BR /&gt;&lt;BR /&gt;my file name is arpt_356789.dbf&lt;BR /&gt;which is saved in variable reala&lt;BR /&gt;&lt;BR /&gt;now, i want to cut the number alone 356789,&lt;BR /&gt;if i use the cut -c 6-11  i will get the number,  but in future the filenumbers may increase the counter value..  can anybody help me in getting that number alone from the variable.. ( i feel some ascii conversion loop is required .. i dont know.. just a guess)&lt;BR /&gt;&lt;BR /&gt;can somebody help me..&lt;BR /&gt;&lt;BR /&gt;also,&lt;BR /&gt;&lt;BR /&gt;how to sftp to other server automatically without typing the password ??&lt;BR /&gt;&lt;BR /&gt;my server is using HPUX 11.11&lt;BR /&gt;&lt;BR /&gt;thanks in advance,&lt;BR /&gt;sivakumar p.&lt;BR /&gt;</description>
      <pubDate>Mon, 27 Jun 2005 11:20:19 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/shell-script-help/m-p/4909378#M405852</guid>
      <dc:creator>joinsiva</dc:creator>
      <dc:date>2005-06-27T11:20:19Z</dc:date>
    </item>
    <item>
      <title>Re: shell script help</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/shell-script-help/m-p/4909379#M405853</link>
      <description>There are number of ways ot do it.&lt;BR /&gt;Shell patern atching would fasted and it will be shell built in function.&lt;BR /&gt;&lt;BR /&gt;Is pattern  arpt_xxxx.dbf common, if yes do it as follows&lt;BR /&gt;&lt;BR /&gt;var1=arpt_356789.dbf&lt;BR /&gt;echo ${var1#arpt_}|awk -F . '{print $1}'&lt;BR /&gt;&lt;BR /&gt;With awk&lt;BR /&gt;&lt;BR /&gt;cat "arpt_356789.dbf" |awk -F _ '{print $2}'|awk -F . '{print $1}'&lt;BR /&gt;&lt;BR /&gt;Anil</description>
      <pubDate>Mon, 27 Jun 2005 11:27:26 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/shell-script-help/m-p/4909379#M405853</guid>
      <dc:creator>RAC_1</dc:creator>
      <dc:date>2005-06-27T11:27:26Z</dc:date>
    </item>
    <item>
      <title>Re: shell script help</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/shell-script-help/m-p/4909380#M405854</link>
      <description>$ file=arpt_356789.dbf&lt;BR /&gt; &lt;BR /&gt;$ echo $file&lt;BR /&gt;arpt_356789.dbf&lt;BR /&gt;&lt;BR /&gt;$ echo $file|tr -cd \[0-9]&lt;BR /&gt;356789&lt;BR /&gt;</description>
      <pubDate>Mon, 27 Jun 2005 12:07:15 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/shell-script-help/m-p/4909380#M405854</guid>
      <dc:creator>Ralph Grothe</dc:creator>
      <dc:date>2005-06-27T12:07:15Z</dc:date>
    </item>
    <item>
      <title>Re: shell script help</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/shell-script-help/m-p/4909381#M405855</link>
      <description>or if you have a Posix shell (like HP-UX sh)&lt;BR /&gt; &lt;BR /&gt;echo ${file#*_}|cut -d. -f1&lt;BR /&gt;356789&lt;BR /&gt;</description>
      <pubDate>Mon, 27 Jun 2005 12:09:53 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/shell-script-help/m-p/4909381#M405855</guid>
      <dc:creator>Ralph Grothe</dc:creator>
      <dc:date>2005-06-27T12:09:53Z</dc:date>
    </item>
    <item>
      <title>Re: shell script help</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/shell-script-help/m-p/4909382#M405856</link>
      <description>There are hundred ways.&lt;BR /&gt;But I'd say the most lightweight is&lt;BR /&gt;shell variable expansion or usage of shell built-ins (read man sh-posix)&lt;BR /&gt;Then comes tr.&lt;BR /&gt;The mos heavy weight are interpreters like awk or Perl.&lt;BR /&gt;And if you use the latter two,&lt;BR /&gt;don't spend superfluous program calls like cat (awk like grep does this inherently)</description>
      <pubDate>Mon, 27 Jun 2005 12:14:11 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/shell-script-help/m-p/4909382#M405856</guid>
      <dc:creator>Ralph Grothe</dc:creator>
      <dc:date>2005-06-27T12:14:11Z</dc:date>
    </item>
    <item>
      <title>Re: shell script help</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/shell-script-help/m-p/4909383#M405857</link>
      <description>Hi,&lt;BR /&gt;&lt;BR /&gt;inspired by Ralph:&lt;BR /&gt;&lt;BR /&gt;# var1=arpt_356789.dbf&lt;BR /&gt;# newvar=$(echo $var1| tr -cd  '[^0-9]')&lt;BR /&gt;# echo $newvar&lt;BR /&gt;356789&lt;BR /&gt;&lt;BR /&gt;regards,&lt;BR /&gt;John K.</description>
      <pubDate>Mon, 27 Jun 2005 13:33:09 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/shell-script-help/m-p/4909383#M405857</guid>
      <dc:creator>john korterman</dc:creator>
      <dc:date>2005-06-27T13:33:09Z</dc:date>
    </item>
    <item>
      <title>Re: shell script help</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/shell-script-help/m-p/4909384#M405858</link>
      <description>Watch it with tr!&lt;BR /&gt;&lt;BR /&gt;sh-3.00$ var1=arp1t_356789.dbf&lt;BR /&gt;sh-3.00$ newvar=$(echo $var1| tr -cd '[^0-9]')&lt;BR /&gt;sh-3.00$ echo $newvar&lt;BR /&gt;1356789&lt;BR /&gt;sh-3.00$ var1=arpt_356789.dbf1&lt;BR /&gt;sh-3.00$ newvar=$(echo $var1| tr -cd '[^0-9]')&lt;BR /&gt;sh-3.00$ echo $newvar&lt;BR /&gt;3567891&lt;BR /&gt;sh-3.00$&lt;BR /&gt;&lt;BR /&gt;If you know it's the only number in the name, you're safe. If there might be more, you're not&lt;BR /&gt;&lt;BR /&gt;if you want the first number&lt;BR /&gt;&lt;BR /&gt;sh-3.00$ var1=arpt_356789.dbf1&lt;BR /&gt;sh-3.00$ newvar=$(echo $var1 | perl -ne'/(\d+)/&amp;amp;&amp;amp;print$1')&lt;BR /&gt;sh-3.00$ echo $newvar&lt;BR /&gt;356789&lt;BR /&gt;sh-3.00$&lt;BR /&gt;&lt;BR /&gt;sed will do too I guess&lt;BR /&gt;&lt;BR /&gt;Enjoy, Have FUN! H.Merijn</description>
      <pubDate>Mon, 27 Jun 2005 13:57:15 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/shell-script-help/m-p/4909384#M405858</guid>
      <dc:creator>H.Merijn Brand (procura</dc:creator>
      <dc:date>2005-06-27T13:57:15Z</dc:date>
    </item>
    <item>
      <title>Re: shell script help</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/shell-script-help/m-p/4909385#M405859</link>
      <description>Sivakumar,&lt;BR /&gt;&lt;BR /&gt;Your filename is stored in a shell script variable and to extract the number string from it, follow the awk excerpt given below:&lt;BR /&gt;&lt;BR /&gt;=============================================&lt;BR /&gt;FNAME=arpt_356789.dbf&lt;BR /&gt;&lt;BR /&gt;echo $FNAME | awk -F"." '{print z[split($1,z,"_")]}'&lt;BR /&gt;=============================================&lt;BR /&gt;&lt;BR /&gt;cheers!</description>
      <pubDate>Mon, 27 Jun 2005 14:01:50 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/shell-script-help/m-p/4909385#M405859</guid>
      <dc:creator>Sandman!</dc:creator>
      <dc:date>2005-06-27T14:01:50Z</dc:date>
    </item>
    <item>
      <title>Re: shell script help</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/shell-script-help/m-p/4909386#M405860</link>
      <description>&amp;gt;&amp;gt;how to sftp to other server automatically without typing the password ??&amp;lt;&amp;lt;&lt;BR /&gt;&lt;BR /&gt;for the above take a look at this URL&lt;BR /&gt;&lt;A href="http://www.snailbook.com/faq/" target="_blank"&gt;http://www.snailbook.com/faq/&lt;/A&gt;</description>
      <pubDate>Mon, 27 Jun 2005 14:23:06 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/shell-script-help/m-p/4909386#M405860</guid>
      <dc:creator>Sandman!</dc:creator>
      <dc:date>2005-06-27T14:23:06Z</dc:date>
    </item>
    <item>
      <title>Re: shell script help</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/shell-script-help/m-p/4909387#M405861</link>
      <description>thanks everybody,&lt;BR /&gt;&lt;BR /&gt;procura, that perl syntax doesn't worked.&lt;BR /&gt;&lt;BR /&gt;anyway, i am using anils solution.&lt;BR /&gt;&lt;BR /&gt;it worked fine.&lt;BR /&gt;&lt;BR /&gt;thanks everybody once again&lt;BR /&gt;&lt;BR /&gt;sivakumar p.</description>
      <pubDate>Tue, 28 Jun 2005 05:53:29 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/shell-script-help/m-p/4909387#M405861</guid>
      <dc:creator>joinsiva</dc:creator>
      <dc:date>2005-06-28T05:53:29Z</dc:date>
    </item>
    <item>
      <title>Re: shell script help</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/shell-script-help/m-p/4909388#M405862</link>
      <description>You can try as,&lt;BR /&gt;&lt;BR /&gt;# echo "arpt_356789.dbf" | sed 's/^.*_//;s/\..*$//'&lt;BR /&gt;356789&lt;BR /&gt;&lt;BR /&gt;# echo "arpt_356789.dbf" | perl -pe 's/^.*_//;s/\..*$//'&lt;BR /&gt;356789&lt;BR /&gt;&lt;BR /&gt;hth.</description>
      <pubDate>Tue, 28 Jun 2005 07:59:18 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/shell-script-help/m-p/4909388#M405862</guid>
      <dc:creator>Muthukumar_5</dc:creator>
      <dc:date>2005-06-28T07:59:18Z</dc:date>
    </item>
    <item>
      <title>Re: shell script help</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/shell-script-help/m-p/4909389#M405863</link>
      <description>Here's one with just the cut command:&lt;BR /&gt;&lt;BR /&gt;$ echo arpt_356789.dbf | cut -f2 -d"_" | cut -f1 -d"."&lt;BR /&gt;356789&lt;BR /&gt;$&lt;BR /&gt;</description>
      <pubDate>Tue, 28 Jun 2005 08:33:16 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/shell-script-help/m-p/4909389#M405863</guid>
      <dc:creator>Seth Parker</dc:creator>
      <dc:date>2005-06-28T08:33:16Z</dc:date>
    </item>
    <item>
      <title>Re: shell script help</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/shell-script-help/m-p/4909390#M405864</link>
      <description>thanks all&lt;BR /&gt;&lt;BR /&gt;it worked.&lt;BR /&gt;&lt;BR /&gt;sivakumar p.</description>
      <pubDate>Tue, 28 Jun 2005 09:43:37 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/shell-script-help/m-p/4909390#M405864</guid>
      <dc:creator>joinsiva</dc:creator>
      <dc:date>2005-06-28T09:43:37Z</dc:date>
    </item>
  </channel>
</rss>

