Sponsored Content
Full Discussion: Problem in while loop
Top Forums Shell Programming and Scripting Problem in while loop Post 302572069 by manas_ranjan on Wednesday 9th of November 2011 06:28:18 AM
Old 11-09-2011
Problem in while loop

Code:
date=$1

function convert_date
{
        cube_date=$1
        v_length=`echo $cube_date | awk '{print length}'`
        if [[ $v_length -ne 8 ]];then
                echo " Wrongly entered parameter , please enter date format as YYYYMMDD"
                exit 1
        fi
        YYYY=$(expr substr "$cube_date" 1 4 )
        MM=$(expr substr "$cube_date" 5 2)
        DD=$(expr substr "$cube_date" 7 2 )
        cal $DD $MM $YYYY >/dev/null 2>&1
        if [[ $? -ne 0 ]];then
                echo "Invalid date entry."
                exit 1
        fi

        case $2 in
        "eu" ) v_date=$YYYY$MM$DD ;;
        "us" ) v_date=$MM$DD$YYYY ;;
        *)      echo "Not valid date format "
                exit 1;;
        esac
}

while read system maskleft maskright folder_prd floder_uat datetype Region
do
        if [[ ${env} -eq "PRD" ]]; then
                case "${datetype}" in
                "eu" ) v_date=`convert_date ${date} ${datetype}`;;
                "us" ) v_date=`convert_date ${date} ${datetype}`;;
                *)      echo "invalid date format for ${system}/${maskleft}/${maskright}/$env"
                        exit 1;;
                esac
                date=$v_date
                filename=${maskleft}${v_date}${maskright}
                targetfolder=${system}/${folder_prd}
                echo $date  $filename $targetfolder

        fi
done < ${AP_Config}/masklist_new.txt

This script read below config file
Code:
####################################################################################################################################################
# SYSTEM              MaskLeft                                MaskRight           Folder Prod         Floder UAT          DateType  Region         #
# 20 Char             40 Char                                 20 Char             20 Char             20 Char             10 Char   10 Char        #
####################################################################################################################################################
  sum              xpnl_hypo_reu_miplvdone_                .csv                hypopnl             hypopnl             eu        europe
  sum              xpnl_hypo_reu_miplvhypo_                .csv                hypopnl             hypopnl             eu        europe
  triss               triss_fxcb_                             .checksum.csv       checksum            checksum            eu        europe
  triss               triss_fxcb_                             .csv                cashbalance         cashbalance         eu        europe

so while executing script i have below problem
can anyone assit me where exactly I'm loosing the grip .
Appreciated if anyone can suggest some betterway to config this
Code:
./filesorting.sh 20111023
invalid date format for ####################################################################################################################################################///PRD

 

10 More Discussions You Might Find Interesting

1. Programming

problem with while loop

hi all, i have written the following code: while(proceed !='Y' && proceed!='N' && proceed!='y' && proceed!='n') { printf("\nPress \n\t 'Y' or 'y' to continue \n\t 'N' or 'n' to cancel:"); scanf("%c",&proceed); } the output i am gettin is: Press 'Y' to continue ... (1 Reply)
Discussion started by: mridula
1 Replies

2. Shell Programming and Scripting

for loop problem

Hi, I have a directory called logs in which i have the log files. i have to touch the file before deleting it. i am doing like this filestodelete="*.log* *log*" for files in $filestodelete do touch $files $files.$(date +%a) rm -f $filestodelete done touch is not working... (5 Replies)
Discussion started by: namishtiwari
5 Replies

3. UNIX for Advanced & Expert Users

loop problem

Hi guys my while do loop is not working properly; As soon as the load_date and run_date is same it should stop can somebody tell me where I am having the problem? In an oracle table I have LOAD_DT=5/1/2009 DATE datatype RUN_DT=5/5/2009 DATE datatype Now in a script with a spool file I get the... (15 Replies)
Discussion started by: henrysmith
15 Replies

4. Shell Programming and Scripting

Problem in While loop

Hi Guys, This is my code.. I am getting an error in the inside while statement when comparing.. I am not able to figure it out.. Pls help me... while read value fatherid son_id top_id r_type do inside_value=1; echo $inside_value; echo $r_type; while do echo... (6 Replies)
Discussion started by: mac4rfree
6 Replies

5. Shell Programming and Scripting

problem with while loop

hi I had created a while loop in a script file called whiletest.sh as follows as follows: count=0 max=10 while do echo $count echo count=$(count+1)" " done echo "value of count:$count" then i run the script with the command sh whilestest.sh but its giving me an error... (5 Replies)
Discussion started by: angel12345
5 Replies

6. UNIX for Dummies Questions & Answers

While loop problem

I have a while loop with -f and -o option.Can any one please tell me what that stands for?The Sample code is as follows:- while do ## some processing done (10 Replies)
Discussion started by: Param0073
10 Replies

7. Shell Programming and Scripting

Problem with While loop.

Hi Script Gurus, I am facing issue with while loop in bash. The while loop is running as end less loop even after given criteria does not meet. STATE_BEFORE_SPLIT () { for clone in $Clonegroups; do state=$( $Navicmd -listclone -name $clone -cloneid $Cloneid |awk... (3 Replies)
Discussion started by: RobP
3 Replies

8. Shell Programming and Scripting

Problem with loop within loop

Hi, I work on Ab-initio ETL tool which is based on Unix. I made a small script which has two loop's one with in another. All the functionality is working for the first line of outer loop but when it comes to other lines of outer loop it is throwing error as command not found. Below is the... (4 Replies)
Discussion started by: Ravindra Swan
4 Replies

9. Shell Programming and Scripting

Problem with While Do loop

I am trying to do a while do loop that asks for a password and returns if the password entered is incorrect. I have that part working however i want to modify it so that if a similar word is entered it will read "that is close but incorrect" and i cannot seem to get it working, being new in the... (6 Replies)
Discussion started by: lm5522
6 Replies

10. Shell Programming and Scripting

Problem with loop

Hi all, a problem with a loop. Imagine it starts with var1="$(cat txtif.out )"while do echo file1 echo file2 echo y > txtif.out if then break fi done exit 0 the problem is that if the file is changing during the loop seems to continue as it reads "x" state,... (5 Replies)
Discussion started by: Board27
5 Replies
ppmtosixel(1)                                                 General Commands Manual                                                ppmtosixel(1)

NAME
ppmtosixel - convert a portable pixmap into DEC sixel format SYNOPSIS
ppmtosixel [-raw] [-margin] [ppmfile] DESCRIPTION
Reads a portable pixmap as input. Produces sixel commands (SIX) as output. The output is formatted for color printing, e.g. for a DEC LJ250 color inkjet printer. If RGB values from the PPM file do not have maxval=100, the RGB values are rescaled. A printer control header and a color assignment table begin the SIX file. Image data is written in a compressed format by default. A printer control footer ends the image file. OPTIONS
-raw If specified, each pixel will be explicitly described in the image file. If -raw is not specified, output will default to com- pressed format in which identical adjacent pixels are replaced by "repeat pixel" commands. A raw file is often an order of magni- tude larger than a compressed file and prints much slower. -margin If -margin is not specified, the image will be start at the left margin (of the window, paper, or whatever). If -margin is speci- fied, a 1.5 inch left margin will offset the image. PRINTING
Generally, sixel files must reach the printer unfiltered. Use the lpr -x option or cat filename > /dev/tty0?. BUGS
Upon rescaling, truncation of the least significant bits of RGB values may result in poor color conversion. If the original PPM maxval was greater than 100, rescaling also reduces the image depth. While the actual RGB values from the ppm file are more or less retained, the color palette of the LJ250 may not match the colors on your screen. This seems to be a printer limitation. SEE ALSO
ppm(5) AUTHOR
Copyright (C) 1991 by Rick Vinci. 26 April 1991 ppmtosixel(1)
All times are GMT -4. The time now is 04:38 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy