Sponsored Content
Top Forums Shell Programming and Scripting Script - Expression not complete more tokens expected Post 302394620 by daveaasmith on Friday 12th of February 2010 05:33:50 AM
Old 02-12-2010
Script - Expression not complete more tokens expected

I have the following script to output a report of response times - but it is throwing the error:

Code:
./jobname[46]: -: 0403-053 Expression is not complete; more tokens expected.

Here is the code, any ideas what the problem is?

(line 46 is simply, LC=0)

Code:
FILE2=/templogs/access_log
FILE3=/templogs/access_log.1
integer LINES=0
integer i5=0
integer i10=0
integer i20=0
integer i30=0
integer i60=0
integer i60p=0
integer TIME=0
integer U=0
integer T=0
integer C=0
typeset -i LT=0
typeset -i LC=0
 
echo "Time              Total       0-5            5-10           10-20          20-30          30-60          60+    Users   Avg tm"
echo ------------------------------------------------------------------------------------------------------------------------------

for HOURS in 00 01 02 03 04 05 06 07 08 09 10 11 12 13 14 15 16 17 18 19 20 21 22 23
do
    for MINS in 0[0-9] 1[0-9] 2[0-9] 3[0-9] 4[0-9] 5[0-9]
    do
        MYTIME=`echo $MINS | cut -d"[" -f1`
        #get users
        T=0
        C=0
 
        for U in `grep "^$HOURS" /templogs/joblog.users | grep -v "Start" | cut -d" " -f2`
        do
                C=$C+1
                T=$T+$U
        done
 
        T=$T*2
 
        grep "20..:$HOURS:${MINS}" $FILE2 > $FILE3
        i5=0
        i10=0
        i20=0
        i30=0
        i60=0
        i60p=0
        LINES=`wc -l $FILE3 | awk '{printf("%d\n",$1);}`
        LT=0
        LC=0
 
        for TIME in `cat $FILE3 | awk '{printf("%s %s %s %s %s %s %s %s %s %s %s %s %s %s %s %s\n",$16,$15,$14,$13,$12,$11,$10,$9,$8,$7,$6,$5,$4,$3,$2,$1);}' | awk '{printf("%s\n",$1);}'`
        do
 
                LT=$LT+$TIME
                LC=$LC+1
                if [ $TIME -lt 5 ]; then
                        i5=$i5+1
                elif [ $TIME -lt 10 ]; then
                        i10=$i10+1
                elif [ $TIME -lt 20 ]; then
                        i20=$i20+1
                elif [ $TIME -lt 30 ]; then
                        i30=$i30+1
                elif [ $TIME -lt 60 ]; then 
                        i60=$i60+1
                else 
                        i60p=$i60p+1
                fi
 
        done
 
        if [ $C -eq 0 ]; then
                C=1
        fi
 
        if [[ -s $FILE3 ]]; then
        echo ${HOURS}:${MYTIME} $LINES $i5 $i10 $i20 $i30 $i60 $i60p $T $C $LT $LC| awk '{ printf("%s0:00-%s9:59 %5d %5d (%05.2f%%) %6d (%05.2f%%) %4d (%05.2f%%) %4d (%05.2f%%) %4d (%05.2f%%) %4d (%05.2f%%)  %5.1f  %5.1f\n",$1,$1,$2,$3,($3*100/$2),$4,($4*100/$2),$5,($5*100/$2),$6,($6*100/$2),$7,($7*100/$2),$8,($8*100/$2),($9/$10),($11/$12));}'
        fi
    done
done


Last edited by Scott; 02-12-2010 at 06:38 AM.. Reason: Code tags, please...
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

: + : more tokens expected

Hello- Trying to add two numbers in a ksh shell scripts and i get this error every time I execute stat1_ex.ksh: + : more tokens expected stat1=`cat .stat1a.tmp | cut -f2 -d" "` stat2=`cat .stat2a.tmp | cut -f2 -d" "` j=$(($stat1 + $stat2)) # < Here a the like the errors out echo $j... (3 Replies)
Discussion started by: Nomaad
3 Replies

2. Fedora

"integer expression expected" error with drive space monitoring script

Hi guys, I am still kinda new to Linux. Script template I found on the net and adapted for our environment: #!/bin/sh #set -x ADMIN="admin@mydomain.com" ALERT=10 df -H | grep -vE '^Filesystem|tmpfs|cdrom' | awk '{ print $5 " " $1 }' | while read output; do #echo $output ... (2 Replies)
Discussion started by: wbdevilliers
2 Replies

3. Shell Programming and Scripting

+: more tokens expected

Hey everyone, i needed some help with this one. We move into a new file system (which should be the same as the previous one, other than the name directory has changed) and the script worked fine in the old file system and not the new. I'm trying to add the results from one with another but i'm... (4 Replies)
Discussion started by: senormarquez
4 Replies

4. Shell Programming and Scripting

:integer expression expected

Hi, echo $i until || do read NUM if && ; then printf "$FBOLD\nInvalid number, please enter valid backup number: $FREG" fi done Getting below error : ./import_location.sh: line 234: [: : integer expression expected ./import_location.sh: line 234: [: :... (5 Replies)
Discussion started by: milink
5 Replies

5. Shell Programming and Scripting

if script error: integer expression expected

Hi, i am making a simple program with a optional -t as the 3rd parameter. Submit course assignment -t dir In the script, i wrote: #!/bin/bash echo "this is course: ${1}" echo "this is assignment #: ${2}" echo "late? : ${3}" if then echo "this is late" fi but this gives me a :... (3 Replies)
Discussion started by: leonmerc
3 Replies

6. Shell Programming and Scripting

Integer expression expected: with regular expression

CA_RELEASE has a value of 6. I need to check if that this is a numeric value. if not error. source $CA_VERSION_DATA if * ] then echo "CA_RELESE $CA_RELEASE is invalid" exit -1 fi + source /etc/ncgl/ca_version_data ++ CA_PRODUCT_ID=samxts ++ CA_RELEASE=6 ++ CA_WEEK_NO=7 ++... (3 Replies)
Discussion started by: ketkee1985
3 Replies

7. UNIX for Dummies Questions & Answers

Integer expression expected error in script

When i run the following code i get an error that says Integer expression expected! How do i fix this? #!/bin/bash if ;then echo "wrong" exit 1 fi if ;then for i in /dev;do if ;then echo $i ls -l fi (4 Replies)
Discussion started by: kotsos13
4 Replies

8. Shell Programming and Scripting

AIX 6.1 Error: 0403-053 Expression is not complete; more tokens expected.

Hi I have been trying every possible solution available for this error on this Forum but could not resolve it. When i am running the below script i get this error.:mad: sh diskMonitor.sh diskMonitor.sh: -: 0403-053 Expression is not complete; more tokens expected. diskMonitor.sh: -:... (5 Replies)
Discussion started by: nitinkatipn
5 Replies

9. Shell Programming and Scripting

Getting error -: more tokens expected in shell script

Hi can someone help me to resolve the error for this condition if ] && ]; then i am passing the values $k and $kkm i am getting the error like "-: more tokens expected" Thanks in Advance (5 Replies)
Discussion started by: makigate
5 Replies

10. Shell Programming and Scripting

Getting error in bash script; expr $a + 1: integer expression expected

Hi, I am new to shell/bash script. I am trying to run below script #!/bin/bash a=0 b=10 if then echo "a is equal to be" else echo "a is not equal to be" fi MAX=10 while do echo $a a='expr $a + 1' done (1 Reply)
Discussion started by: Mallikgm
1 Replies
TIME(2) 						     Linux Programmer's Manual							   TIME(2)

NAME
time - get time in seconds SYNOPSIS
#include <time.h> time_t time(time_t *t); DESCRIPTION
time() returns the time as the number of seconds since the Epoch, 1970-01-01 00:00:00 +0000 (UTC). If t is non-NULL, the return value is also stored in the memory pointed to by t. RETURN VALUE
On success, the value of time in seconds since the Epoch is returned. On error, ((time_t) -1) is returned, and errno is set appropriately. ERRORS
EFAULT t points outside your accessible address space. CONFORMING TO
SVr4, 4.3BSD, C89, C99, POSIX.1-2001. POSIX does not specify any error conditions. NOTES
POSIX.1 defines seconds since the Epoch using a formula that approximates the number of seconds between a specified time and the Epoch. This formula takes account of the facts that all years that are evenly divisible by 4 are leap years, but years that are evenly divisible by 100 are not leap years unless they are also evenly divisible by 400, in which case they are leap years. This value is not the same as the actual number of seconds between the time and the Epoch, because of leap seconds and because system clocks are not required to be syn- chronized to a standard reference. The intention is that the interpretation of seconds since the Epoch values be consistent; see POSIX.1-2008 Rationale A.4.15 for further rationale. SEE ALSO
date(1), gettimeofday(2), ctime(3), ftime(3), time(7) COLOPHON
This page is part of release 3.53 of the Linux man-pages project. A description of the project, and information about reporting bugs, can be found at http://www.kernel.org/doc/man-pages/. Linux 2011-09-09 TIME(2)
All times are GMT -4. The time now is 12:44 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy