Sponsored Content
Full Discussion: Issue with using While loop
Top Forums Shell Programming and Scripting Issue with using While loop Post 302570685 by funonnet on Friday 4th of November 2011 04:47:39 AM
Old 11-04-2011
Below is my script,

Code:
date=`date +"%Y%m%d%H%M%S"`
#TEST_FILE_LOG="`echo $1`"

if [ -s $COPY_FILES_LIST ]; then
    rm $COPY_FILES_LIST
fi

DUMMY=`ssh -l $FTP_USER $FTP_HOST /home/ftpuser/get_test_file.sh`
sudo scp -p $FTP_USER@$FTP_HOST:/home/ftpuser/test_files_list.txt $COPY_FILES_LIST

fileCount=`wc -l < $COPY_FILES_LIST`

    myFile=$COPY_FILES_LIST
    while read line
    do 

        I_CLI_CODE="`print $line | cut -f5 -d'/'`"
    
        if echo $I_CLI_CODE | egrep -q '^[0-9]+$'; then

            $JAVA_COMMAND -classpath ${PROCESSES_HOME_DIR}:${PROCESSES_HOME_DIR}:${JDBC_JAR_FILE}:. com.TestFile $DB_HOST $DB_PORT $DB_SID $DB_USER $DB_PASSWD $I_CLI_CODE $TEST_FILE_LIST
            cli_code=$I_CLI_CODE

            file=$line
            ftpfilename=`basename "$line"`
            filename=`basename "$line"`-$cli_code
        
            sudo scp -p $FTP_USER@$FTP_HOST:$line $SCPED_TEST_FILES$filename
            SCP_STATUS=$?
            if (test "$SCP_STATUS" = "0"); then
                find $SCPED_TEST_FILES*.* -type f  -print | grep -i test > $STG_TEST_FILES

                DUMMY=`ssh -l $FTP_USER $FTP_HOST /home/ftpuser/remove_test_files.sh $I_CLI_CODE $ftpfilename $file`

                myFile=$GETCLIENT_NAME_STATUS
                while read line
                do

                    cli_name="`print $line | cut -f2 -d'/'`"
                    cli_status="`print $line | cut -f3 -d'/'`" 
                    myFile=$STG_TEST_FILES
                    while read line 
                    do

                        scpd_filename=`basename "$line"`

                        if (test "$scpd_filename" = "$filename"); then

                            if [ -d $SCPED_TEST_FILES"$cli_name"_$cli_code ]
                            then
                            echo "$DIR directory  exists!"
                            else
                                mkdir $SCPED_TEST_FILES"$cli_name"_$cli_code
                            fi

                        ## Code to move the file to client specific directory goes here ##

                        fi


                    done < $STG_TEST_FILES

                done < $GETCLIENT_NAME_STATUS

            fi

        else

            print " "                                                                    >> $TEST_FILE_LIST
            print 'Failed to move the Test file from the path' "$line"                                        >> $TEST_FILE_LIST
            print " "                                                                    >> $TEST_FILE_LIST

            print " "                                                                    >> $TEST_FILE_LOG
            print 'Failed to move the Test file from the path' "$line"                                         >> $TEST_FILE_LOG
            print " "                                                                    >> $TEST_FILE_LOG

        fi

    done < $COPY_FILES_LIST

 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Help With A For Loop Issue

I was wondering how I can modify this for loop, so it only loops through the filenames that do not have an ".old" extension. for filename in $(ls "$1") do echo $filename | grep '\.old$' > /dev/null if then mv $1/$filename $1/$filename.old fi done (5 Replies)
Discussion started by: ralts01
5 Replies

2. Shell Programming and Scripting

while loop issue

Hi, Following is my code and the file FILE_LIST_EXCESS.txt has 40 file names in it while read LineIn do echo ${LineIn} `ftp -vin << END_INPUT >> ${PID}_DS_GET_Log.log 2>&1 open servername user userid password cd FileDir get ${LineIn} END_INPUT`... (4 Replies)
Discussion started by: mgirinath
4 Replies

3. Shell Programming and Scripting

loop issue

I have 2 files one of them has all the all mac addresses and the other one has all the ip addresses. Basically, I want to loop thru those 2 files and generate a configuration like below: host www184.domain.com { hardware ethernet 00:13:72:3B:B4:3A; fixed-address 192.168.0.184; }... (4 Replies)
Discussion started by: kkkk
4 Replies

4. Shell Programming and Scripting

loop issue

function ext { echo "THANKS & WELCOME BACK" } function upc { echo "TO EXPORT UPROC GIVE UPROC NAME PER LINE IN THE input.txt and PRESS Y" echo "TO GO BACK PRESS 99" read parm0 if ; then start elif ; then for i in `cat input.txt` ; do echo $i $UXEXE/uxext upr upr=$i... (0 Replies)
Discussion started by: kojo
0 Replies

5. Shell Programming and Scripting

until loop issue.

Hi, my script is waiting for 3 files to come to a folder for 30 min but even when all the files arrive in the folder it's still waiting for these three files. Files can come with in 2 min and I want it to start processing them immediately after all the files arrive in the folder. until ; do... (3 Replies)
Discussion started by: gurpartap
3 Replies

6. Shell Programming and Scripting

for-while loop issue

sup experts..i had a script which was bugging me..was hoping someone could point out the issue here Input file: space separated 2 columns I wanted to print out the 2 columns after assigning them to variables ( bascially the same output but iterate through line by line ). The code worked... (7 Replies)
Discussion started by: foal_newbie
7 Replies

7. Shell Programming and Scripting

While Loop issue

Hi, i=0 t5=6000001 while do i=`expr $i + 1` t5=`expr $t5 + 1` echo $t5 done I am able to increment "col3" value but unable to get col1,col2 value. Input: t1=10001 t2=abc t3=ghkc (5 Replies)
Discussion started by: onesuri
5 Replies

8. Shell Programming and Scripting

Issue with while loop?

Hi, I have prepared a script to search for backup file information on the Linux server. Script works fine for the most part except the echo statement inside an IF conditional block displays the message ''snapshot directory not found on xxxxx" even though the .snapshot directory is found a... (11 Replies)
Discussion started by: svajhala
11 Replies

9. Shell Programming and Scripting

Issue with for loop

Hi Team, I have for loop in my shell script. Which basically loop through all files in the directory, When some files are in the directory it works just fine. But if there are no files at all..still the for loop try to execute. Please help. Below is the code. #!/bin/ksh echo "Program... (5 Replies)
Discussion started by: bharath561989
5 Replies

10. UNIX for Beginners Questions & Answers

Issue when doing a loop

Hi, I just have started learning shell scripting (sh). Why do i only get the date? while read dt do echo "Date : ${dt} sed -n '/${dt}/,/${dt}/p' file1.log | grep -w ERROR done < date1.dat INPUT - date1.dat 2019-04-05 04:58:25 2019-04-05 04:58:26 2019-04-05 05:00:56... (3 Replies)
Discussion started by: margel
3 Replies
MECAB-CONFIG(1) 					      General Commands Manual						   MECAB-CONFIG(1)

NAME
mecab-config - Get command-line flags for building stuff using Mecab SYNOPSIS
mecab-config [OPTION] ... DESCRIPTION
mecab-config gives information about how Mecab is configured on your system, giving necessary command line options to build your applica- tions. Known values for OPTION are: --cxx print C++ compiler used to compile Mecab --prefix print Mecab prefix --exec-prefix print Mecab executable prefix --libs print library linking information --cflags print preprocessor flags, I_opts, and compiler options --dicdir print path to directory containing dictionaries --libexecdir print path to directory containing helper executables --libs-only-L print linker "-L" flags for dynamic linking --libs-only-l print dynamic linker "-l" flags --inc-dir print "-I" include options --help print this help and exit --version print version information SEE ALSO
mecab(1). AUTHOR
This manual page was written by TSUCHIYA Masatoshi <tsuchiya@namazu.org>, for the Debian project (but may be used by others). Aug 15th, 2003 MECAB-CONFIG(1)
All times are GMT -4. The time now is 02:36 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy