Sponsored Content
Top Forums Shell Programming and Scripting In the script I get additional file, which I don't expect do get Post 302993623 by digioleg54 on Sunday 12th of March 2017 10:48:10 AM
Old 03-12-2017
In the script I get additional file, which I don't expect do get

I have the following script

Code:
 #!/bin/sh
Usage () {
         echo "Usage: $0 <config_file>"
        echo "Example:   ./sftp_ondemand_daily.sh /export/data/mbsesb/config/ond
emand.cfg /export/data/mbsesb/config/filename.lst"
        exit 1
}
 if [ $# -lt 2 ]
then
        Usage
fi
 config_file=${1}
FILELIST=${2}
NAME=`basename $0 .sh`
Today=`date '+%Y%m%d'`
TS=`date '+%Y%m%d%H%M%S'`
LOG=${NAME}.log
TIMESTAMP=`date +%H:%M:%S`
LOCAL_SERVER=`hostname`
LOCL_WORKING_DIR=`grep "^local" $config_file | cut -d'=' -f2`
LOGDIR=`grep "^log" $config_file | cut -d'=' -f2`
DESTSERVNAME=`grep "^destserver" $config_file | cut -d'=' -f2`
USERID=`grep "^userid" $config_file | cut -d'=' -f2`
DESTDIR=`grep "^destinationdir" $config_file | cut -d'=' -f2`
HEADERNM=`grep "^headerondemand" $config_file | cut -d'=' -f2`
#APPLICATION=`grep "^application" $config_file | cut -d'=' -f2`
ACCTNUMGRP=`grep "^acctnmgrp" $config_file | cut -d'=' -f2`
DAYFILE=`grep "^daily" $config_file | cut -d'=' -f2`
#WEEKFILE=`grep "^weekly" $config_file | cut -d'=' -f2`
#MONTHFILE=`grep "monthly" $config_file | cut -d'=' -f2`
ENDFILE=`grep "^tail" $config_file | cut -d'=' -f2`
INDFILE=`grep "^index" $config_file | cut -d'=' -f2`
OUTFILE=`grep "^outfile" $config_file | cut -d'=' -f2`
COOLDIR=`grep "^coollocal" $config_file | cut -d'=' -f2`
LOGF=${LOGDIR}/${NAME}.${Today}.${TIMESTAMP}.log
CONFIGDIR=`echo $config_file | rev | cut -d'/' -f2- | rev`
 PORTNUM=0
cd ${COOLDIR}/cool_${Today}/daily
for file in *_${Today}*.csv *_${Today}*.txt
do
        echo "Start woprking with ${file} to prepare rename them to Ondemand for
mat" >> ${LOGF}
#daily_pool, daily_tba, daily_rmbs and let files will be proccesed in separate
#+script at the end of this proccess, ther are files with feeds
         if [ "${file}" = "LET_daily_trans_${Today}.csv" ] ||  [ "${file}" = "LET
_daily_trans_345_${Today}.csv" ]
        then
                echo "This file will be processed in separate script" >> ${LOGF}
                continue
        fi
        #Process daily files  with *_YYYYMMDDHHMMSS.csv and/or *_YYYYMMDDHHMMSS.
txt
         firstpreffix=`echo ${file} | cut -d'_' -f 1`
        ext=`echo $file | rev | cut -d'.' -f 1 | rev`  case ${firstpreffix} in
                roundrobin)
                        suffix=`echo ${file} |  cut -d'.' -f 1 |  rev | cut -d'_
' -f 1 | rev`
                        partfilename=${firstpreffix}${suffix}
                        timestamp=`echo ${file} |  awk -F_ '{print $(NF-1)}'`
                        newtmstamp=`echo ${timestamp} |  sed 's/\-/\./g'`
                        sftp_name=`grep "^${partfilename}" ${FILELIST} | cut -d'
=' -f2`
                        name=`echo ${file} |  cut -d'_' -f-4`
                ;;
                MBSE)
                        partfilename=`echo ${file} | awk -F'_' '{for (i=1; i<NF;
 i++) printf("%s_", $i)}'`
                        if [ "${partfilename}" = "MBSE_daily_trans_sum_" ];then
                                sftp_name=MBSEDTRNSUM
                        elif [ "${partfilename}" = "MBSE_daily_trans_badcpn_" ];
then
                                sftp_name=MBSEDTRNBADCPN
                        elif [ "${partfilename}" = "MBSE_daily_trans_sum_345_" ]
;then
                                sftp_name=MBSEDTRNSUM345
 elif [ "${partfilename}" = "MBSE_daily_trans_sum_345_" ]
;then
                                sftp_name=MBSEDTRNSUM345
                        elif [ "${partfilename}" = "MBSE_daily_trans_badcpn_345_
" ];then
                                sftp_name=MBSEDTRNBADCPN345
                        elif [ "${partfilename}" = "MBSE_daily_trans_" ];then
                                sftp_name=MBSEDAYTRNS
                        elif [ "${partfilename}" = "MBSE_daily_trans_345_" ];the
n
                                sftp_name=MBSEDAYTRNS345
                        else
                                echo "Unnkowned prefix name ${prefix}">> ${LOGF}
                        fi
                        timestamp=`echo "${file}" |  cut -d'.' -f 1 |  rev | cut
 -d'_' -f 1 | rev`
                        newtmstamp=`echo ${timestamp} |sed 's/.\{8\}/&./g'`
                        name=${partfilename}
                ;;
                safe)
                        partfilename=`echo ${file%${file#*_*_*_*_?}}`
                        sftp_name=`grep "^${partfilename}" ${FILELIST} | cut -d'
=' -f2` chgname=`echo ${file} | cut -d'_' -f-5`
                        name=`echo ${file} | cut -d'_' -f-4`
                        timestamp=`echo ${file} | cut -d'.' -f 1 |  rev | cut -d'_' -f 1 | rev'`
                        newtmstamp=`echo ${timestamp} |sed 's/.\{8\}/&./g'`
                ;;
                ocr)
                        partfilename=`echo "${file}" | awk -F'_' '{for (i=1; i<NF; i++) printf("%s_", $i)}'`
                        sftp_name=`grep "^${partfilename}" ${FILELIST} | cut -d'=' -f2`
                        timestamp=`echo "${file}" |  cut -d'.' -f 1 |  rev | cut -d'_' -f 1 | rev`
                        name=${partfilename}
                        newtmstamp=`echo "${file}" |  cut -d'.' -f 1 |  rev | cut -d'_' -f 1 | rev |  sed 's/\-/\./g'`
                ;;
                show)
                        partfilename=`echo "${file}" | awk -F'_' '{for (i=1; i<NF; i++) printf("%s_", $i)}'`
                        sftp_name=`grep "^${partfilename}" ${FILELIST} | cut -d'=' -f2`
                        timestamp=`echo "${file}" |  cut -d'.' -f 1 |  rev | cut -d'_' -f 1 | rev`
                        newtmstamp=`echo "${timestamp}" | sed 's/.\{8\}/&./g'`
                        name=${partfilename}
                ;;
                monafter)
                        partfilename=`echo "${file}" | awk -F'_' '{for (i=1; i<NF; i++) printf("%s_", $i)}'`
                        sftp_name=`grep "^${partfilename}" ${FILELIST} | cut -d'=' -f2`
                        timestamp=`echo "${file}" |  cut -d'.' -f 1 |  rev | cut -d'_' -f 1 | rev`
                        newtmstamp=`echo "${timestamp}" |  sed 's/.\{8\}/&./g'`
                        name=${partfilename}
                ;;
        esac
        sftp_file=${HEADERNM}.${DAYFILE}.${sftp_name}.${ACCTNUMGRP}.${newtmstamp}
        if [ "${ext}" != "txt" ];then
                sftp_ind=${sftp_file}.ARD.ind
                sftp_ard=${sftp_file}.ARD
                touch ${sftp_ard}
                sftp_out=${sftp_file}.ARD.out
        else
                sftp_ind=${sftp_file}.ARD.ind
                sftp_out=${sftp_file}.ARD.out
        fi
        if [ "${name}" = "roundrobin_report_ALL_dbagadm" ]
        then
                echo "MOVEROUND ${name}_${timestamp}_${suffix}.${ext} ${sftp_out}" >> ${LOGF}
                mv ${name}_${timestamp}_${suffix}.${ext} ${sftp_out}
        elif [ "${name}" = "safe_alloc_TBA_details" ]
    then
                echo "MOVESAFE ${chgname}_${timestamp}.${ext} ${sftp_out}" >> ${LOGF}
                mv ${chgname}_${timestamp}.${ext} ${sftp_out}
        elif [ "${name}" = "ocr_recon_report_all_dbagadm_" ]
        then
                echo "MOVEOCR ${name}${timestamp}.${ext} ${sftp_out}" >> ${LOGF}
                mv ${name}${timestamp}.${ext} ${sftp_out}
        else
                echo "MOVE ${name}${timestamp}.${ext} ${sftp_out}">>${LOGF}
                mv ${name}${timestamp}.${ext} ${sftp_out}
        fi
         if [ "${ext}" != "txt" ];then
                echo "Create index file ${sftp_ind}" >>${LOGF}
                echo "COMMENT: .ind Index File Layout" >> ${sftp_ind}
                echo "CODEPAGE:819" >> ${sftp_ind}
                echo "GROUP_FIELD_NAME:MBSSB" >> ${sftp_ind}
                echo "GROUP_FIELD_VALUE:${file}" >> ${sftp_ind}
                echo "GROUP_FIELD_NAME:MBSSBDATE" >> ${sftp_ind}
                echo "GROUP_FIELD_VALUE:${Today}" >> ${sftp_ind}
                echo "GROUP_OFFSET:0" >> ${sftp_ind}
                echo "GROUP_LENGTH:0" >> ${sftp_ind}
                echo "GROUP_FILENAME:${DESTDIR}/${sftp_out}" >> ${sftp_ind}
                echo "COMMENT: End of Index file" >> ${sftp_ind}
                echo "Call sftp_demand to sftp files to Ondemand server" >>${LOGF}
                sftp_ondemand
        fi
done
 for file in *.${Today}*.csv *.${Today}*.txt
do
        echo "we are in *.${Today}*.csv *.${Today}*.txt">> ${LOGF}
        echo "Start woprking with ${file} to prepare rename them to Ondemand format">> ${LOGF}
        if [ "${file}" = "daily_tba_position.${Today}" ]  || [ "${file}" =  "daily_pool_position.${Today}" ]  || [ "${file}" = "LET.${Today}" ];then
                echo "files were processed by the brkvol_day_sftp_ondemand.sh script">> ${LOGF}
                continue
        fi
    case ${file} in
                sum_details_*.${Today}*.csv )
                        filename=`echo $file | cut -d'.' -f 1`
                        sftp_name=SUMDETS
                        namedate=`echo ${file} | cut -d'.' -f 2`
                        filedate=`echo ${namedate} |  sed 's/.\{8\}/&./g'`
                        sftp_file=${HEADERNM}.${DAYFILE}.${sftp_name}.${ACCTNUMGRP}.${filedate}
                        sftp_ind=${sftp_file}.ARD.ind
                        sftp_ard=${sftp_file}.ARD
                        touch ${sftp_ard}
                        sftp_out=${sftp_file}.ARD.out
                        echo "MOVE ${filename}.${namedate}.csv ${sftp_out}">> ${LOGF}
                        mv ${filename}.${namedate}.csv ${sftp_out}
                        if [ "${ext}" != "txt" ];then
                                echo "Create index file ${sftp_ind}" >>${LOGF}
                                echo "COMMENT: .ind Index File Layout" >> ${sftp_ind}
                                echo "CODEPAGE:819" >> ${sftp_ind}
                                echo "GROUP_FIELD_NAME:MBSSB" >> ${sftp_ind}
                                echo "GROUP_FIELD_VALUE:${file}" >> ${sftp_ind}
                                echo "GROUP_FIELD_NAME:MBSSBDATE" >> ${sftp_ind}
                                echo "GROUP_FIELD_VALUE:${Today}" >> ${sftp_ind}
                                echo "GROUP_OFFSET:0" >> ${sftp_ind}
                                echo "GROUP_LENGTH:0" >> ${sftp_ind}
                                echo "GROUP_FILENAME:${DESTDIR}/${sftp_out}" >> ${sftp_ind}
                                echo "COMMENT: End of Index file" >> ${sftp_ind}
                                echo "Call sftp_demand to sftp files to Ondemand server" >>${LOGF}
                                sftp_ondemand
                        fi
                ;;
                sum_*.${Today}*.csv)
                        filename=`echo $file | cut -d'.' -f 1`
                        sftp_name=SUM
                        namedate=`echo $file | cut -d'.' -f 2`
                        filedate=`echo ${namedate} |  sed 's/.\{8\}/&./g'`
                        sftp_file=${HEADERNM}.${DAYFILE}.${sftp_name}.${ACCTNUMGRP}.${filedate}
                        sftp_ind=${sftp_file}.ARD.ind
                        sftp_ard=${sftp_file}.ARD
                        touch ${sftp_ard}
                        sftp_out=${sftp_file}.ARD.out
                        mv ${filename}.${namedate}.csv ${sftp_out}
                         if [ "${ext}" != "txt" ];then
                                echo "Create index file ${sftp_ind}" >>${LOGF}
                               echo "COMMENT: .ind Index File Layout" >> ${sftp_ind}
                                echo "CODEPAGE:819" >> ${sftp_ind}
                                echo "GROUP_FIELD_NAME:MBSSB" >> ${sftp_ind}
                                echo "GROUP_FIELD_VALUE:${file}" >> ${sftp_ind}
                                echo "GROUP_FIELD_NAME:MBSSBDATE" >> ${sftp_ind}
                                echo "GROUP_FIELD_VALUE:${Today}" >> ${sftp_ind}
                                echo "GROUP_OFFSET:0" >> ${sftp_ind}
                                echo "GROUP_LENGTH:0" >> ${sftp_ind}
                                echo "GROUP_FILENAME:${DESTDIR}/${sftp_out}" >> ${sftp_ind}
                                echo "COMMENT: End of Index file" >> ${sftp_ind}
                                echo "Call sftp_demand to sftp files to Ondemand server" >>${LOGF}
                                sftp_ondemand
                        fi
                ;;
                mod_pool_trade_report.${Today}*.csv)
                        filename=`echo $file | cut -d'.' -f 1`
                        sftp_name="MODPTRDRTP"
                        namedate=`echo $file | cut -d'.' -f 2`
                        filedate=`echo ${namedate} |  sed 's/.\{8\}/&./g'`
                        sftp_file=${HEADERNM}.${DAYFILE}.${sftp_name}.${ACCTNUMGRP}.${filedate}
                        sftp_ind=${sftp_file}.ARD.ind
                        sftp_ard=${sftp_file}.ARD
                        touch ${sftp_ard}
                        sftp_out=${sftp_file}.ARD.out
                        mv ${filename}.${namedate}.csv ${sftp_out}
                         if [ "${ext}" != "txt" ];then
                                echo "Create index file ${sftp_ind}" >>${LOGF}
                                echo "COMMENT: .ind Index File Layout" >> ${sftp_ind}
                                echo "CODEPAGE:819" >> ${sftp_ind}
                                echo "GROUP_FIELD_NAME:MBSSB" >> ${sftp_ind}
                                echo "GROUP_FIELD_VALUE:${file}" >> ${sftp_ind}
                                echo "GROUP_FIELD_NAME:MBSSBDATE" >> ${sftp_ind}
                                echo "GROUP_FIELD_VALUE:${Today}" >> ${sftp_ind}
                                echo "GROUP_OFFSET:0" >> ${sftp_ind}
                                echo "GROUP_LENGTH:0" >> ${sftp_ind}
                                echo "GROUP_FILENAME:${DESTDIR}/${sftp_out}" >> ${sftp_ind}
                                echo "COMMENT: End of Index file" >> ${sftp_ind}
                                echo "Call sftp_demand to sftp files to Ondemand server" >>${LOGF}
                                sftp_ondemand
                        fi
                ;;
                               filename=`echo $file | cut -d'.' -f 1`
                        sftp_name=RPTMNALC
                        namedate=`echo $file | cut -d'.' -f 2`
                        filedate=`echo ${namedate} |  sed 's/.\{8\}/&./g'`
                        sftp_file=${HEADERNM}.${DAYFILE}.${sftp_name}.${ACCTNUMGRP}.${filedate}
                        sftp_ind=${sftp_file}.ARD.ind
                        sftp_ard=${sftp_file}.ARD
                        touch ${sftp_ard}
                        sftp_out=${sftp_file}.ARD.out
                        echo "MOVE ${filename}.${namedate}.csv ${sftp_out}"
                        mv ${filename}.${namedate}.csv ${sftp_out}
                         if [ "${ext}" != "txt" ];then
                                echo "Create index file ${sftp_ind}" >>${LOGF}
                                echo "COMMENT: .ind Index File Layout" >> ${sftp_ind}
                                echo "CODEPAGE:819" >> ${sftp_ind}
                                echo "GROUP_FIELD_NAME:MBSSB" >> ${sftp_ind}
                                echo "GROUP_FIELD_VALUE:${file}" >> ${sftp_ind}
                                echo "GROUP_FIELD_NAME:MBSSBDATE" >> ${sftp_ind}
                                echo "GROUP_FIELD_VALUE:${Today}" >> ${sftp_ind}
                                echo "GROUP_OFFSET:0" >> ${sftp_ind}
                                echo "GROUP_LENGTH:0" >> ${sftp_ind}
                                echo "GROUP_FILENAME:${DESTDIR}/${sftp_out}" >> ${sftp_ind}
                                echo "COMMENT: End of Index file" >> ${sftp_ind}
                                echo "Call sftp_demand to sftp files to Ondemand server" >>${LOGF}
                                sftp_ondemand
                        fi
                ;;
                short_pool_rpt.${Today}*.csv)
                        filename=`echo $file | cut -d'.' -f 1`
                        sftp_name=`grep "^${filename}" ${FILELIST} | cut -d'=' -f2`
                        namedate=`echo $file | cut -d'.' -f 2`
                        filedate=`echo ${namedate} |  sed 's/\-/\./g'`
                        sftp_file=${HEADERNM}.${DAYFILE}.${sftp_name}.${ACCTNUMGRP}.${filedate}
                        sftp_ind=${sftp_file}.ARD.ind
                        sftp_ard=${sftp_file}.ARD
                        touch ${sftp_ard}
                        sftp_out=${sftp_file}.ARD.out
                        mv ${filename}.${namedate}.csv ${sftp_out}
                         if [ "${ext}" != "txt" ];then
                                echo "Create index file ${sftp_ind}" >>${LOGF}
                                echo "COMMENT: .ind Index File Layout" >> ${sftp_ind}
                                echo "CODEPAGE:819" >> ${sftp_ind}
                                echo "GROUP_FIELD_NAME:MBSSB" >> ${sftp_ind}
          report_manual_alloc_rpt.${Today}*.csv)
                                 echo "GROUP_FIELD_VALUE:${file}" >> ${sftp_ind}
                                echo "GROUP_FIELD_NAME:MBSSBDATE" >> ${sftp_ind}
                                echo "GROUP_FIELD_VALUE:${Today}" >> ${sftp_ind}
                                echo "GROUP_OFFSET:0" >> ${sftp_ind}
                                echo "GROUP_LENGTH:0" >> ${sftp_ind}
                                echo "GROUP_FILENAME:${DESTDIR}/${sftp_out}" >> ${sftp_ind}
                                echo "COMMENT: End of Index file" >> ${sftp_ind}
                                echo "Call sftp_demand to sftp files to Ondemand server" >>${LOGF}
                                sftp_ondemand
                        fi
                ;;
                *)
                        filename=`echo ${file} | cut -d'.' -f 1`
                        ext=`echo ${file} | rev | cut -d'.' -f 1 | rev`
                        #processid=`echo ${filename} | awk -F_ '{print $NF}'`
                        #echo "PROC = ${processid}"
                        #prefix=`echo ${filename} |rev | cut -d'_' -f2- | rev`
                        #echo "PREFIX = ${prefix}"
                        if [ "${ext}" != "txt" ]
                        then
                                echo "Process extension 'csv' file" >> ${LOGF}
                                sftp_name=`grep "^${filename}" ${FILELIST} | cut -d'=' -f2`
                                namedate=`echo ${file} | cut -d'.' -f 2`
                                if [ "${sftp_name}" = "GU" ] || [ "${sftp_name}" = "suspend_tbas" ]
                                then
                                        namedate=`date '+%Y%m%d.%H%M%S'`
                                fi
                                sftp_file=${HEADERNM}.${DAYFILE}.${sftp_name}.${ACCTNUMGRP}.${namedate}
                                sftp_ind=${sftp_file}.ARD.ind
                                sftp_ard=${sftp_file}.ARD
                                touch ${sftp_ard}
                                sftp_out=${sftp_file}.ARD.out
                                fldt=`echo ${namedate} | cut -c 9`
                                if [ "${fldt}" = "-" ];then
                                        filedate=`echo ${namedate} | sed 's/-/\./g'`
                                        sftp_file=${HEADERNM}.${DAYFILE}.${sftp_name}.${ACCTNUMGRP}.${filedate}
                                        mv ${filename}.${newnamedate}.${ext} ${sftp_out}
                                else
                                        filedate=`echo ${namedate} |sed 's/.\{8\}/&./g'`
                                        sftp_file=${HEADERNM}.${DAYFILE}.${sftp_name}.${ACCTNUMGRP}.${filedate}
                                fi
                                mv ${filename}.${namedate}.${ext} ${sftp_out}
                        else
                                echo "Process extension 'txt' file" >> ${LOGF}
                                sftp_name=`grep "^${filename}" ${FILELIST} | cut -d'=' -f2`
                                namedate=`echo $file | cut -d'.' -f 2`
                                filedate=`echo ${namedate} |  sed 's/.\{8\}/&./g'`
                                sftp_file=${HEADERNM}.${DAYFILE}.${sftp_name}.${ACCTNUMGRP}.${filedate}
                                #sftp_ind=${sftp_file}.ARD.ind
                                #echo "IND ${sftp_ind}"
                                sftp_ard=${sftp_file}.ARD
                                touch ${sftp_ard}
                                sftp_out=${sftp_file}.ARD.out
                                mv ${filename}.${namedate}.${ext} ${sftp_out}
                        fi
         if [ "${ext}" != "txt" ];then
                echo "Create index file ${sftp_ind}" >>${LOGF}
                echo "COMMENT: .ind Index File Layout" >> ${sftp_ind}
                echo "CODEPAGE:819" >> ${sftp_ind}
                echo "GROUP_FIELD_NAME:MBSSB" >> ${sftp_ind}
                echo "GROUP_FIELD_VALUE:${file}" >> ${sftp_ind}
                echo "GROUP_FIELD_NAME:MBSSBDATE" >> ${sftp_ind}
                echo "GROUP_FIELD_VALUE:${Today}" >> ${sftp_ind}
                echo "GROUP_OFFSET:0" >> ${sftp_ind}
                echo "GROUP_LENGTH:0" >> ${sftp_ind}
                echo "GROUP_FILENAME:${DESTDIR}/${sftp_out}" >> ${sftp_ind}
                echo "COMMENT: End of Index file" >> ${sftp_ind}
                echo "Call sftp_demand to sftp files to Ondemand server" >>${LOGF}
                sftp_ondemand
        else
                echo "Call sftp_demand_txt to sftp files to Ondemand server" >>${LOGF}
                sftp_ondemand_txt
        fi
        esac
echo "end of for loop"
done

As result I have to receive bunch of files like this
Code:
 DB.DAILY.FILENAME.MBSSB_GROUPNAME.YYYYMMDD.HHMMSS.ARD
 or extension ARD.ind
 extension ARD.out

Everything is ok except one. The first file is
Code:
 DB.DAILY..MBSSB_GROUPNAME.YYYYMMDD.HHMMSS.ARD
 extension ARD.ind, ARD.out

Could you let me know the problem?

Thanks for contribution
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Run expect script in systems that don't support it out of box

Noob question .. My Java based application needs to change some user passwords based on some user actions. Since this application can run on Redhat AS2.1 / AS4.0 / Solaris 9 etc, the most safe and portable solution that I could think of was: Use expect. Now, expect is not available on all... (1 Reply)
Discussion started by: namityadav
1 Replies

2. Shell Programming and Scripting

input from a file into an expect script ?

Hi, I have an expect script that logs into a host (via ssh) requests the hostid then exits... I am happy with that. However how can I run the same script in a kind of 'while read line' and enter lots of hosts? My knowledge is still very limited (as you will soon see) so any other ideas would... (2 Replies)
Discussion started by: starsky
2 Replies

3. Shell Programming and Scripting

strange expect script behavior, or am i misunderstanding expect scripting?

Hello to all...this is my first post (so please go easy). :) I feel pretty solid at expect scripting, but I'm running into an issue that I'm not able to wrap my head around. I wrote a script that is a little advanced for logging into a remote Linux machine and changing text in a file using sed.... (2 Replies)
Discussion started by: v1k0d3n
2 Replies

4. UNIX for Dummies Questions & Answers

Expect Script - While file exist

Hi: Can anyone help me with the while loop in expect script. Following is my scenario: 1. one of my process is running and looking for a file 2. as soon as the file is dropped the proces then processes the file and creates a control file ".ctl" to indicate end of process for that file ... (5 Replies)
Discussion started by: skal5
5 Replies

5. Shell Programming and Scripting

Need help with Expect script for Cisco IPS Sensors, Expect sleep and quoting

This Expect script provides expect with a list of IP addresses to Cisco IPS sensors and commands to configure Cisco IPS sensors. The user, password, IP addresses, prompt regex, etc. have been anonymized. In general this script will log into the sensors and send commands successfully but there are... (1 Reply)
Discussion started by: genewolfe
1 Replies

6. Programming

Calling expect script inside another expect

Hi, Am very new to expect scripting.. Can You please suggest me how to call an expect script inside another expect script.. I tried with spawn /usr/bin/ksh send "expect main.exp\r" expect $root_prompt and spawn /usr/bin/ksh send "main.exp\r" expect $root_prompt Both... (1 Reply)
Discussion started by: Priya Amaresh
1 Replies

7. Programming

Calling another expect script inside an expect script

I have an expect script called remote that I want to call from inside my expect script called sudoers.push, here is the code that is causing me issues: set REMOTE "/root/scripts/remote" ... log_user 1 send_user "Executing remote script as $user...\n" send_user "Command to execute is: $REMOTE... (1 Reply)
Discussion started by: brettski
1 Replies

8. Shell Programming and Scripting

AIX -/usr/bin/expect shows output Don't know why.

Hi, I have been programming with the expect program for a while now and have create a series of menu driven checks for the operations team. One thing I have noticed is that I call a remote script and pass parameters and this is display on the screen....for example. Within the script ... (0 Replies)
Discussion started by: yakky
0 Replies

9. Programming

Expect script returning string following a found expect.

I'm fairly new to scripting so this might not be possible. I am using Expect with Cisco switches and need to capture the string after finding the expect request. For example, when I issue "show version" on a Nexus switch, I'm looking to capture the current firmware version: #show version ... (0 Replies)
Discussion started by: IBGaryA
0 Replies

10. Red Hat

Script creates additional file

Hi, I have created a test script like this : # cat script1.sh DAY=$(date +%d) MONTH=$(date +%b) YEAR=$(date +%Y) BC01="Blast_BC01" BC15="Blast_BC15" DIR1="$MONTH$YEAR_$BC01" DIR2="$MONTH$YEAR_$BC07" DIR3="$MONTH$YEAR_$BC15" if ;then mkdir -p "$YEAR/$DIR3" fi # When I... (5 Replies)
Discussion started by: anaigini45
5 Replies
All times are GMT -4. The time now is 08:52 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy