<?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 New script in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/new-script/m-p/5663579#M638099</link>
    <description>&lt;P&gt;I would like to have a new script to perform the below task .&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;I have a file called dummy.txt , the content of this file is as below .&lt;/P&gt;&lt;P&gt;aaa.prn&lt;BR /&gt;bbb.prn&lt;BR /&gt;ccc.prn&lt;/P&gt;&lt;P&gt;I would like to have a script which can do&lt;/P&gt;&lt;P&gt;1) check dummy.txt&lt;BR /&gt;2) then copy these files ( but with other extension .xls ) from a specify directory to another server&lt;BR /&gt;&amp;nbsp;&amp;nbsp; eg. scp the files /tmp/aaa.xls , /tmp/bbb.xls , /tmp/ccc.xls to /tmp of another server&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;can advise what can i do ?&lt;/P&gt;&lt;P&gt;thanks in advance.&lt;/P&gt;</description>
    <pubDate>Mon, 21 May 2012 10:23:19 GMT</pubDate>
    <dc:creator>Intothenewworld</dc:creator>
    <dc:date>2012-05-21T10:23:19Z</dc:date>
    <item>
      <title>New script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/new-script/m-p/5663579#M638099</link>
      <description>&lt;P&gt;I would like to have a new script to perform the below task .&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;I have a file called dummy.txt , the content of this file is as below .&lt;/P&gt;&lt;P&gt;aaa.prn&lt;BR /&gt;bbb.prn&lt;BR /&gt;ccc.prn&lt;/P&gt;&lt;P&gt;I would like to have a script which can do&lt;/P&gt;&lt;P&gt;1) check dummy.txt&lt;BR /&gt;2) then copy these files ( but with other extension .xls ) from a specify directory to another server&lt;BR /&gt;&amp;nbsp;&amp;nbsp; eg. scp the files /tmp/aaa.xls , /tmp/bbb.xls , /tmp/ccc.xls to /tmp of another server&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;can advise what can i do ?&lt;/P&gt;&lt;P&gt;thanks in advance.&lt;/P&gt;</description>
      <pubDate>Mon, 21 May 2012 10:23:19 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/new-script/m-p/5663579#M638099</guid>
      <dc:creator>Intothenewworld</dc:creator>
      <dc:date>2012-05-21T10:23:19Z</dc:date>
    </item>
    <item>
      <title>Re: New script (to copy files)</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/new-script/m-p/5664333#M638100</link>
      <description>&lt;P&gt;You could do something like:&lt;/P&gt;&lt;P&gt;for file in $(&amp;lt; dummy.txt); do&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; base=${file%.prn}&amp;nbsp;&amp;nbsp; # strip suffix&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; scp /tmp/$base.xls remote:/tmp&lt;/P&gt;&lt;P&gt;done&lt;/P&gt;</description>
      <pubDate>Mon, 21 May 2012 19:33:19 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/new-script/m-p/5664333#M638100</guid>
      <dc:creator>Dennis Handly</dc:creator>
      <dc:date>2012-05-21T19:33:19Z</dc:date>
    </item>
    <item>
      <title>Re: New script (to copy files)</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/new-script/m-p/5664583#M638102</link>
      <description>&lt;P&gt;it works , but may I have two additional requirement .&lt;/P&gt;&lt;P&gt;1) actually , the file name in dummy.txt have two type of prefix , one is xxx ( eg. xxxfile.prn ) , another one is yyy ( yyyfile.prn ) , if the file is xxx , then copy to /tmp of&amp;nbsp; another server , if the file is yyy then copy to /tmp1 of another server , can advise what can i do ?&lt;/P&gt;&lt;P&gt;2) scp works fine to copy to remote server , can advise how to check and display if the scp is successful on the screen or not ?&lt;/P&gt;&lt;P&gt;thx&lt;/P&gt;</description>
      <pubDate>Tue, 22 May 2012 03:23:31 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/new-script/m-p/5664583#M638102</guid>
      <dc:creator>Intothenewworld</dc:creator>
      <dc:date>2012-05-22T03:23:31Z</dc:date>
    </item>
    <item>
      <title>Re: New script (to copy files)</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/new-script/m-p/5664837#M638103</link>
      <description>&lt;P&gt;&amp;gt;1) the filename in dummy.txt have two type of prefix, one is xxx (eg. xxxfile.prn), another one is yyy (yyyfile.prn), if the file is xxx , then copy to /tmp of another server, if the file is yyy then copy to /tmp1 of another server?&lt;/P&gt;&lt;P&gt;&amp;gt;2) can advise how to check and display if the scp is successful on the screen or not?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Did you want to remove that prefix?&amp;nbsp; I'm not doing it here.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;for file in $(&amp;lt; dummy.txt); do&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; base=${file%.prn}&amp;nbsp;&amp;nbsp; # strip suffix&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; if [[ $base = xxx* ]]; then&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; server=server1&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; tmp=/tmp&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; elif [[ $base = yyy* ]]; then&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; server=server2&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; tmp=/tmp1&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; else&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; echo "Not sure where to send $file" 1&amp;gt;&amp;amp;2&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; continue&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; fi&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; scp /tmp/$base.xls $server:$tmp&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; if [ $? -ne 0 ]; then&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; echo "scp failed to copy $file" 1&amp;gt;&amp;amp;2&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; fi&lt;/P&gt;&lt;P&gt;done&lt;/P&gt;</description>
      <pubDate>Wed, 23 May 2012 00:52:15 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/new-script/m-p/5664837#M638103</guid>
      <dc:creator>Dennis Handly</dc:creator>
      <dc:date>2012-05-23T00:52:15Z</dc:date>
    </item>
  </channel>
</rss>

