Find the answer to your Linux question:
Results 1 to 1 of 1
Hi All, I require to write a script on the following requirement: There are some files which are downloaded on to Unix level, i should rename the files to file ...
  1. #1
    Just Joined!
    Join Date
    Oct 2009
    Posts
    1

    Script requirement

    Hi All,

    I require to write a script on the following requirement:

    There are some files which are downloaded on to Unix level, i should rename the files to file name format like ETL_XXXX.DSTAMP (XXXX is the numeric which I take from the source file at Unix level using cut -c). Then these files shoud be transferred to target using FTP. Could anyone help me on this at the earliest?

    I have worked on the following, could anyone guide me with the corrections:


    While read $WORKDIR

    do

    CCODE=`cut -c 6-9`

    cp -p $CCODE ETL_$CCODE.$DSTAMP$MVDDIR

    done <$WORKDIR


    # GET the file using FTP
    echo "FTP GET phase of script" >> $LOGSDIR$LOGSFIL.log.$DSTAMP
    echo "" >> $LOGSDIR$LOGSFIL.log.$DSTAMP
    ( echo "user anilc@usalpd66.ge.com anilc\$"
    echo "bin"
    echo "put $MVDDIR $WORKDIR$DESTFIL"
    echo "quit" ) | ftp -niv usalpd66.ge.com > $LOGSDIR$LOGSFIL.ftpstatus.log.$DSTAMP 2>&1
    cat $LOGSDIR$LOGSFIL.ftpstatus.log.$DSTAMP >> $LOGSDIR$LOGSFIL.log.$DSTAMP

    Regards,
    Anil Kumar CH
    Last edited by anilc; 10-19-2009 at 03:03 PM. Reason: Addition of data

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
...