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
MELD(1) 						      General Commands Manual							   MELD(1)

NAME
meld - Visual diff and merge tool for the GNOME Desktop SYNOPSIS
meld [options] meld [options] FILE1 meld [options] DIR1 meld [options] FILE1 FILE2 [FILE3] meld [options] DIR1 DIR2 [DIR3] DESCRIPTION
Meld is a graphical diff viewer and merge application for the Gnome desktop. It supports 2 and 3-file diffs, recursive directory diffs, diffing of directories under version control (Arch, Bazaar, Codeville, CVS, Darcs, Git, Mercurial, Monotone, RCS), as well as the ability to manually and automatically merge file differences. OPTIONS
--auto-compare, -a Automatically compare all differing files on startup. --diff FILE1|DIR1 FILE2|DIR2 [FILE3|DIR3] Create a diff tab for the given files or directories. Note that "meld --diff FILE1 FILE2" is functionally equivalent to "meld FILE1 FILE2". However, the --diff argument can be given multiple times for one invocation of meld which allows the user to automatically initiate multiple diffs when meld starts. See examples below. --help, -h Print application help and usage. --LABEL=<label>, -L <label> Set application window title to <label>. --version Print application version and exit. EXAMPLES
meld Run meld without initiating a diff. meld FILE1 Initiate a diff between FILE1 and the version-controlled copy of FILE1. meld DIR1 Initiate a recursive diff between DIR1 and the version-controlled copy of DIR1. meld FILE1 FILE2 Initiate a diff between FILE1 and FILE2. meld FILE1 FILE2 FILE3 Initiate a 3-way diff between FILE1, FILE2, and FILE3. meld DIR1 DIR2 Initiate a recursive diff between directory DIR1 and DIR2. meld DIR1 DIR2 DIR3 Initiate a recursive 3-way diff between directory DIR1, DIR2, and DIR3. meld --diff FILE1 FILE2 --diff FILE3 FILE4 Initiate a diff between FILE1 and FILE2, and a separate diff between FILE3 and FILE4. BUGS
If you find a bug, please report it at https://bugzilla.gnome.org/buglist.cgi?product=meld or mail a description of the issue to meld- list@gnome.org. AUTHORS
See the AUTHORS text file in meld's source code (http://git.gnome.org/browse/meld/tree/AUTHORS). 26 Sept 2010 MELD(1)
All times are GMT -4. The time now is 08:46 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy