In the script I get additional file, which I don't expect do get


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting In the script I get additional file, which I don't expect do get
# 1  
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
# 2  
Old 03-12-2017
  1. What operating system are you using?
  2. What shell are you using?
  3. How are you invoking this script? What is in the files that you are giving your script as operands?
  4. Why haven't you run your script with tracing enabled so you can see exactly what is going on when you are creating the file (or files) that you don't want your script to create?
  5. Given the other 18 threads that you have started that we have been discussing in the last week, is there some reason why we have to keep asking these same questions in every thread you start?
  6. Why is the code issuing a usage message unless exactly two operands are given when the usage message printed says that there should only be one operand AND shows an example that issues two commands (each with a single operand)???
These 2 Users Gave Thanks to Don Cragun For This Post:
# 3  
Old 03-12-2017
Like Don at point 6, 3 hours ago when I saw an error at the second line of a script, it made me wonder if I was fit enough to go through all the code, knowing there might be more errors... after having been at work again today and now dead tired,the answer was no I dont have the strength. So like Don I am wondering why the information you give us the presenting the code is so lacunar, specially when your code sends echoes, why dont you show us the true output, do you really think we are after days of work in the mood of going through the code because you are unwilling to show us the true output, to try to guess what you might have done wrong?
# 4  
Old 03-14-2017
I am using AIX
Code:
#!/bin/sh

I put echo statement after each line, but now it is on QA, I cannot have all print statements.
You have asked me to put all lines before, now you ask me, why I put all line? It is really confusing.
In my log file I see the first line
Code:
we are working on *.20170311.*txt files

that is why probably I get one incorrect file.
All input files are with different names, but some have xxx_Today date.csv or .txt, some have xxx.Today date.csv or. txt
Hopefully this can help you?

---------- Post updated 03-14-17 at 08:18 AM ---------- Previous update was 03-13-17 at 10:22 AM ----------

May be you are such cool specialist, but I will never get help from you.

Thanks for nothing

---------- Post updated at 07:42 PM ---------- Previous update was at 08:18 AM ----------

Do I understand correctly, that you will not help me with this issue?
# 5  
Old 03-14-2017
Quote:
Originally Posted by digioleg54
... ... ...

---------- Post updated at 07:42 PM ---------- Previous update was at 08:18 AM ----------

Do I understand correctly, that you will not help me with this issue?
No! What you should understand is that I asked you 6 questions in post #2 in this thread and you have still only answered two of those questions.

Your code has lots of echo statements in it. You have not shown us the output produced by any of those echo statements (which might help us understand what your code is seeing while it is running).

We have suggested that you should trace the execution of your script and show us the output produced. You have chosen to keep us in the dark and not provide us with that information.

You have stated that your log file contains the text:
Code:
we are working on *.20170311.*txt files

but we can look at the code that you have shown us and unequivocally state that that message was not produced by the code you have shown us.

If we:
  • don't know what is in the files your code is processing,
  • don't know what code you are running,
  • don't know how you are running your code,
  • and don't know what output your code is producing while it is running,
there isn't much that we can do to help you. If you would like to:
  • answer our questions,
  • show us a representative sample of the contents of the files your code is processing,
  • show us the actual code that you are running when processing the data samples you show us,
  • show us the output that is produced by your code when processing the data samples you show us,
  • and run your code with tracing enabled and show us the trace output,
then we might be able to help you track down your problem.

We aren't sitting at your terminal. We can't see the code you are running. We can't see the files that your code is processing. We can't see the output produced by your code. We don't have the data that you have so that we can figure out what your code might do (even if we try to run your code on our own systems). Only you have that information and you have chosen not to help us help you.

We would love to help you, but you have chosen to hide the information from us that we need to be able to help you. Please help us help you.
# 6  
Old 03-15-2017
On top of what Don Cragun (and others) stated before, I strongly believe that posting

Quote:
Originally Posted by digioleg54
.
.
.
May be you are such cool specialist, but I will never get help from you.

Thanks for nothing
.
.
.
won't make you too popular or get you decent help in any voluntary forum. Courtesy, cooperation, and patience are priceless.
# 7  
Old 03-15-2017
OK, dear all, I already found the problem and solved it. See you next time
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. 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

2. 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

3. 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

4. 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

5. 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

6. 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

7. 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

8. 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

9. 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

10. 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
Login or Register to Ask a Question