<?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: Script in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/script/m-p/4704685#M655883</link>
    <description>Hi all it is working now...Thanks all for your help&lt;BR /&gt;</description>
    <pubDate>Wed, 19 Jan 2011 06:14:06 GMT</pubDate>
    <dc:creator>Shikha Punyani</dc:creator>
    <dc:date>2011-01-19T06:14:06Z</dc:date>
    <item>
      <title>Script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/script/m-p/4704676#M655874</link>
      <description>Hello All,&lt;BR /&gt;&lt;BR /&gt;I have to create a script where I have to move a file name of type FILEXXX_XXX_XXXX.TXT_YYMMDDHHMM.gz  from one directory to another directory and once moved, I want to gunzip the file and remove the timestamp.&lt;BR /&gt;Have to run it in KSH shell.&lt;BR /&gt;&lt;BR /&gt;I am new to scripting ..Can anyone please suggest ASAP?</description>
      <pubDate>Mon, 25 Oct 2010 21:54:42 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/script/m-p/4704676#M655874</guid>
      <dc:creator>Shikha Punyani</dc:creator>
      <dc:date>2010-10-25T21:54:42Z</dc:date>
    </item>
    <item>
      <title>Re: Script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/script/m-p/4704677#M655875</link>
      <description>&lt;!--!*#--&gt;You could use something like this:&lt;BR /&gt;&lt;BR /&gt;srce=./test&lt;BR /&gt;dest=./test2&lt;BR /&gt;for file in $(ls $srce)&lt;BR /&gt;do&lt;BR /&gt;   newf=$(echo $file | sed 's/\.TXT_.*\.gz//').TXT.gz&lt;BR /&gt;   mv $srce/$file $dest/$newf&lt;BR /&gt;   gunzip $dest/$newf&lt;BR /&gt;done&lt;BR /&gt;</description>
      <pubDate>Mon, 25 Oct 2010 22:57:53 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/script/m-p/4704677#M655875</guid>
      <dc:creator>Jim Walls</dc:creator>
      <dc:date>2010-10-25T22:57:53Z</dc:date>
    </item>
    <item>
      <title>Re: Script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/script/m-p/4704678#M655876</link>
      <description>Hello Jim, Thanks a lot for your quick response.&lt;BR /&gt;I am very new to  this.&lt;BR /&gt;&lt;BR /&gt;I have this request  to perform :&lt;BR /&gt; Move the file under &lt;BR /&gt;/u03/UBIDW/data/BART/FILE135_PI_TURNAWAYS.TXT_YYMMDDHHMM.gz to /u03/UBIDW/data/inbound -gunzipping the file and removing the _YYMMDDHHMM extension.&lt;BR /&gt;&lt;BR /&gt;/u03/UBIDW/data/BART is the source&lt;BR /&gt;/u03/UBIDW/data/inbound is  the destination.&lt;BR /&gt;File has a fixed value which is  FILE135_PI_TURNAWAYS.TXT_YYMMDDHHMM.gz. It will always come on our server in  this format.&lt;BR /&gt;&lt;BR /&gt;1. When it will move to inbound, it should gunzip and remove the timestamp. That is the task which I need to perform...&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Second thing is :&lt;BR /&gt;we already had scripts for such tasks. an example of that script is :&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;exec 1&amp;gt;&amp;gt;/oracle/EBAIX/files/inputs/xxtng/mis/logs/HKP_COM_AIX_EBW04.log 2&amp;gt;&amp;gt;/oracle/EBAIX/files/inputs/xxtng/mis/logs/HKP_COM_&lt;BR /&gt;AIX_EBW04.log&lt;BR /&gt;&lt;BR /&gt;#csc_startmsg&lt;BR /&gt;&lt;BR /&gt;STATUS=$1&lt;BR /&gt;filelist="$2"&lt;BR /&gt;#STATUS=SUCCESS&lt;BR /&gt;#filelist=FILE134_PI_RESERVATION_OR_STAY.TXT&lt;BR /&gt;&lt;BR /&gt;#echo $STATUS&lt;BR /&gt;#echo $filelist&lt;BR /&gt;###############################################################################&lt;BR /&gt;# Begin the Main process&lt;BR /&gt;&lt;BR /&gt;if [ "$STATUS" = "SUCCESS" ]&lt;BR /&gt;then&lt;BR /&gt;        cd /u03/PBIDW/data/backup;&lt;BR /&gt;        pattern="${filelist}[_,.]`date '+%y%m%d'`"&lt;BR /&gt;        filename=`ls -1 ${pattern}*`&lt;BR /&gt;        rc=$?&lt;BR /&gt;        if [ $rc -ne 0 ]&lt;BR /&gt;        then&lt;BR /&gt;                echo "Today's file has yet not arrived";&lt;BR /&gt;                exit 6;&lt;BR /&gt;&lt;BR /&gt;        else&lt;BR /&gt;                if [ `echo $filename  | wc -w` -ne 1 ]&lt;BR /&gt;                then&lt;BR /&gt;                        echo "More than one file has arrived today. Check with Ops Analyst"&lt;BR /&gt;                        exit 6;&lt;BR /&gt;                fi&lt;BR /&gt;&lt;BR /&gt;                cp /u03/PBIDW/data/backup/${filename} /u03/PBIDW/data/inbound&lt;BR /&gt;                rc=$?&lt;BR /&gt;                if [ $rc -ne 0 ]&lt;BR /&gt;                then&lt;BR /&gt;                        echo "Copy of file $filename to /u03/PBIDW/data/inbound failed"&lt;BR /&gt;                        exit 6&lt;BR /&gt;                else&lt;BR /&gt;                        echo "Copy of file $filename to /u03/PBIDW/data/inbound was successful"&lt;BR /&gt;&lt;BR /&gt;fi&lt;BR /&gt;&lt;BR /&gt;                cd /u03/PBIDW/data/inbound;&lt;BR /&gt;                new_filename=${filename%TXT*}"TXT"&lt;BR /&gt;                echo $new_filename&lt;BR /&gt;                mv $filename $new_filename&lt;BR /&gt;                echo "new Filename = "$new_filename&lt;BR /&gt;        fi&lt;BR /&gt;else&lt;BR /&gt;        for filename in `cd /u03/UBIDW/data/inbound;ls -1 $filelist`&lt;BR /&gt;        do&lt;BR /&gt;        mv /u03/UBIDW/data/inbound/${filename} /u03/UBIDW/data/error/${filename}_`date '+%y%m%d%H%M%S'`&lt;BR /&gt;        rc=$?&lt;BR /&gt;        if [ $rc -ne 0 ]&lt;BR /&gt;        then&lt;BR /&gt;        echo "Move of file $filename to /u03/UBIDW/data/error failed"&lt;BR /&gt;        exit 6&lt;BR /&gt;        else&lt;BR /&gt;        echo "Move of file $filename to /u03/UBIDW/data/error was successful"&lt;BR /&gt;        fi&lt;BR /&gt;        done&lt;BR /&gt;fi&lt;BR /&gt;&lt;BR /&gt;exit 0&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;I have to make modifications in this script to run that task meantioned above...&lt;BR /&gt;&lt;BR /&gt;Any suggestions what changes I have to made to this scripts?&lt;BR /&gt;&lt;BR /&gt;Thanks a ton for your support :)</description>
      <pubDate>Mon, 25 Oct 2010 23:12:12 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/script/m-p/4704678#M655876</guid>
      <dc:creator>Shikha Punyani</dc:creator>
      <dc:date>2010-10-25T23:12:12Z</dc:date>
    </item>
    <item>
      <title>Re: Script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/script/m-p/4704679#M655877</link>
      <description>&lt;!--!*#--&gt;Without actually doing the modifications for you, I can explain what the steps in my snippet do... you can then use that information to modify your script as you require.&lt;BR /&gt;&lt;BR /&gt;#Set up the source and destination directories&lt;BR /&gt;srce=/u03/UBIDW/data/BART&lt;BR /&gt;dest=/u03/UBIDW/data/inbound&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;# Assuming you have located the source file:&lt;BR /&gt;# perhaps using the ls command.&lt;BR /&gt;&lt;BR /&gt;cd $srce&lt;BR /&gt;pattern="${filelist}[_,.]$(date '+%y%m%d')"&lt;BR /&gt;filename=$(ls -1 ${pattern}*)&lt;BR /&gt;.&lt;BR /&gt;.&lt;BR /&gt;.&lt;BR /&gt;&lt;BR /&gt;# first generate a new name - remove everything between ".TXT_" and ".gz" - ie. the date-time stamp&lt;BR /&gt;newfile=$(echo $filename | sed 's/\.TXT_.*\.gz//').TXT.gz&lt;BR /&gt;&lt;BR /&gt;# Now move the file to the destination&lt;BR /&gt;mv $srce/$filename $dest/$newfile&lt;BR /&gt;&lt;BR /&gt;# And, finally, uncompress it&lt;BR /&gt;gunzip $dest/$newfile&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Tue, 26 Oct 2010 01:13:11 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/script/m-p/4704679#M655877</guid>
      <dc:creator>Jim Walls</dc:creator>
      <dc:date>2010-10-26T01:13:11Z</dc:date>
    </item>
    <item>
      <title>Re: Script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/script/m-p/4704680#M655878</link>
      <description>Jim&lt;BR /&gt;That was such a quick response, I will try to make script in office today.&lt;BR /&gt;Thanks for making the meaning of the lines clear to me.&lt;BR /&gt;You have included everyting in script :)&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Best Regards &lt;BR /&gt;Shikha</description>
      <pubDate>Tue, 26 Oct 2010 07:48:20 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/script/m-p/4704680#M655878</guid>
      <dc:creator>Shikha Punyani</dc:creator>
      <dc:date>2010-10-26T07:48:20Z</dc:date>
    </item>
    <item>
      <title>Re: Script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/script/m-p/4704681#M655879</link>
      <description>Hello Again,&lt;BR /&gt;&lt;BR /&gt;I have written the script in test enviorment and it looks like this:&lt;BR /&gt;&lt;BR /&gt;I have attached it in a notepad..Can you please check if I have properly closed loops of IF by doing fi and can you see any other typo error in it?&lt;BR /&gt;&lt;BR /&gt;Thanks Again :)&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Tue, 26 Oct 2010 21:20:21 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/script/m-p/4704681#M655879</guid>
      <dc:creator>Shikha Punyani</dc:creator>
      <dc:date>2010-10-26T21:20:21Z</dc:date>
    </item>
    <item>
      <title>Re: Script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/script/m-p/4704682#M655880</link>
      <description>HI:&lt;BR /&gt;&lt;BR /&gt;Scripts shuld begin with a "she-bang" line that defines the interpreter to use.  Add:&lt;BR /&gt;&lt;BR /&gt;#!/usr/bin/sh&lt;BR /&gt;&lt;BR /&gt;...to yours.  Then, verify the syntax with:&lt;BR /&gt;&lt;BR /&gt;# sh -n ./scriptname&lt;BR /&gt;&lt;BR /&gt;Regards!&lt;BR /&gt;&lt;BR /&gt;...JRF...</description>
      <pubDate>Tue, 26 Oct 2010 22:45:39 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/script/m-p/4704682#M655880</guid>
      <dc:creator>James R. Ferguson</dc:creator>
      <dc:date>2010-10-26T22:45:39Z</dc:date>
    </item>
    <item>
      <title>Re: Script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/script/m-p/4704683#M655881</link>
      <description>Hi James:&lt;BR /&gt;I apologize, I pasted it wrong , actually it loooks like the file which is attached now .&lt;BR /&gt;</description>
      <pubDate>Tue, 26 Oct 2010 22:54:35 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/script/m-p/4704683#M655881</guid>
      <dc:creator>Shikha Punyani</dc:creator>
      <dc:date>2010-10-26T22:54:35Z</dc:date>
    </item>
    <item>
      <title>Re: Script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/script/m-p/4704684#M655882</link>
      <description>I will let you guys know whether its executing fine or not.&lt;BR /&gt;However I will go to office after 3 days now.&lt;BR /&gt;Apologies for delay.&lt;BR /&gt;&lt;BR /&gt;This was my first script.&lt;BR /&gt;Thanks a ton for helping me with this. that too with quick response :)</description>
      <pubDate>Tue, 26 Oct 2010 22:58:12 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/script/m-p/4704684#M655882</guid>
      <dc:creator>Shikha Punyani</dc:creator>
      <dc:date>2010-10-26T22:58:12Z</dc:date>
    </item>
    <item>
      <title>Re: Script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/script/m-p/4704685#M655883</link>
      <description>Hi all it is working now...Thanks all for your help&lt;BR /&gt;</description>
      <pubDate>Wed, 19 Jan 2011 06:14:06 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/script/m-p/4704685#M655883</guid>
      <dc:creator>Shikha Punyani</dc:creator>
      <dc:date>2011-01-19T06:14:06Z</dc:date>
    </item>
  </channel>
</rss>

