Sponsored Content
Top Forums Shell Programming and Scripting end of file problem with shell script Post 57194 by whatisthis on Wednesday 20th of October 2004 02:43:21 PM
Old 10-20-2004
Well .That didn't fix the problem.

Here is my script:
Can someone help me find out what is wrong?


==================================
#! /bin/ksh

#CREATE A TMP DIRECTORY TO DUMP TMP FILES FROM THIS PROGRAM
if [ ! -d /tmp/breaktime ]
then
mkdir /tmp/breaktime
fi

#INITIALIZE VARIABLES

# GET INTERVIEWER LIST
/usr/ucb/echo "Enter interviewer numbers or leave blank for all interviewers"
/usr/ucb/echo -n "ENTER: "

read intvw

if [ -z "$intvw" ]
then

ls /mil1_usr1/time_logs/investigator > /tmp/breaktime/intvwtmp.$$
ls /mil2_usr1/time_logs/investigator >> /tmp/breaktime/intvwtmp.$$
ls /mil3_usr1/time_logs/investigator >> /tmp/breaktime/intvwtmp.$$
sort -u /tmp/breaktime/intvwtmp.$$ > /tmp/breaktime/list.$$
rm -f /tmp/breaktime/intvwtmp.$$


for i in `cat /tmp/breaktime/list.$$`
do

# GET ALL FILES
#EMPLOYEE# TIME TIMECLOCKCODE SHIFTTYPE EMPLOYEENAME

/usr/bin/cat /mil1_usr1/time_logs/investigator/$i /mil2_usr1/time_logs/investigator/$i /mil3_usr1/time_logs/investigator/$i >> /tmp/breaktime/time.$$ 2> /dev/null

done

/usr/bin/awk '{print $1,$6,$3,$7,$2}' /tmp/breaktime/time.$$ | /usr/bin/sort > /tmp/breaktime/tmp.$$

#GO THROUGH LOOP TO GET PAID BREAK TIME AND UNPAID BREAK TIME FOR EACH
#INTERVIEWER

while read rec
do

if [ "$intNewID" -eq "$intID" ] && [ -n "$intID" ]
then

intNewID=`/usr/ucb/expr substr "$rec" 1 4`
intNewStart=`/usr/ucb/expr substr "$rec" 6 10`
intNewCODE=`/usr/ucb/expr substr "$rec" 17 2`
intNewSHIFT=`/usr/ucb/expr substr "$rec" 20 1`

if [ "$intCODE" = "5" ]
then
intPaidBreak=`/usr/ucb/expr $intNewStart-$intStart`
echo "$intPaidBreak"
intTotalPaidBreak=`/usr/ucb/expr $intPaidBreak+$intTotalPaidBreak`
elif [ "$intCODE" = "54ektimereport.13273 ]
echo "$intTotalPaidBreak"
then
intUnpaidBreak=`/usr/ucb/expr $intNewStart-$intStart`
intTotalUnpaidBreak=`/usr/ucb/expr $intUnpaidBreak+$intTotalUnpaidBreak`
fi

else
#START READ IN A NEW ID RECORD

intID=`/usr/ucb/expr substr "$rec" 1 4`
intStart=`/usr/ucb/expr substr "$rec" 6 10`
intCODE=`/usr/ucb/expr substr "$rec" 17 2`
intSHIFT=`/usr/ucb/expr substr "$rec" 20 1`
# strNAME=`/usr/ucb/expr substr "$rec" 22 $len("$rec")`
strNAME=`/usr/ucb/expr substr "$rec" 22 20` /usr/ucb/echo "$intID" "$strNAME" "$intSHIFT" "$intTotalPaidBreak" "$intTotalUnpaidBreak" > /tmp/breaktime/breaktimereport.$$

fi
done < /tmp/breaktime/tmp.$$

fi
========================================
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Problem with Calling sql file from shell script

I have created abc.sh file which will set the environment variables (UNIX env variables as well as ORACLE required variables like ORACLE_SID,ORACLE_HOME etc) and then calls a function file which checks for starts some logs and then it will try to execute the .sql file. The .sh, function file are as... (1 Reply)
Discussion started by: sskc
1 Replies

2. Shell Programming and Scripting

Problem printing the property of xml file via shell script

Hi, I have a config.xml which cointains the tags like <CONFIG> <PROPERTY name="port" value="1111"/> <PROPERTY name="dbname" value="ABCDE"/> <PROPERTY name="connectstring" value="xyz/pwd"/> </CONFIG> This file is in some directory at UNix box. I need to write a... (4 Replies)
Discussion started by: neeto
4 Replies

3. Shell Programming and Scripting

File reading problem via shell script

Hi, Data file named parameter contains : DB=y Alter_def.sql Create_abc.sql SQL=y database.sql my_data.sql To read this file I use var_sql=$(awk -F= '$1 == "SQL" { print $2 }' parameter.txt) if then sql_f_name=`grep "\.sql" parameter.txt` echo $sql_f_name fi (2 Replies)
Discussion started by: Dip
2 Replies

4. Shell Programming and Scripting

Help on shell script : syntax error at line 62: `end of file' unexpected

Hi All, I have written a korn script (code pasted below). It is giving the error while debugging "new.sh: syntax error at line 62: `end of file' unexpected". I have re-written the whole code in VI and explored all help related to this error on this Unix forum and tried it. Somehow, I could... (7 Replies)
Discussion started by: schandrakar1
7 Replies

5. UNIX for Dummies Questions & Answers

Shell Script to end process help

I'm trying to write shell script that when invoke, has 2 arguements, or 1. If there's one arguement, then that's the process name. If there's 2, then one is the timeout. USAGE: Assign1.sh <process> <timeout> If no timeout was set, then the default timeout is 15 minutes. So after it read the... (6 Replies)
Discussion started by: NoobieBoobie
6 Replies

6. Solaris

gunzip problem! unexpected end of file

I've downloaded the tomcat from the link below and ftp to Solaris by ftp in binary mode Ref: Index of /dist/jakarta/tomcat-5/v5.0.30/bin gunzip -c jakarta-tomcat-5.0.30.tar.gz | tar -xvf - gunzip: jakarta-tomcat-5.0.30.tar.gz: unexpected end of file tar: read error: unexpected EOF ... (8 Replies)
Discussion started by: sbox
8 Replies

7. Shell Programming and Scripting

Problem getting the content of a file in a shell script variable

Hi, I have a text file that has a long multi-line db2 CTE query. Now I want to store all the contents of this file (i.e. the entire query) in a shell script variable. I am trying to achieve it by this: query = `cat /Folder/SomeFile.txt` But when I echo the contents of this file by saying echo... (4 Replies)
Discussion started by: DushyantG
4 Replies

8. Shell Programming and Scripting

Problem with writing into a file through shell script

Hi all, I have a shell script which I use to login to the server from the client and then from the server I run a bunch of other scripts to complete my task. I am having problems with the script below- #!/bin/bash while read line do connections=`echo $line | cut -d " " -f 1` period=`echo... (3 Replies)
Discussion started by: joydeep4u
3 Replies

9. Shell Programming and Scripting

help needed with shell script to append to the end of a specific line in a file on multiple servers

Hi Folks, I was given a task to append three IP's at the end of a specific (and unique) line within a file on multiple servers. I was not able to do that with the help of a script. All I could was: for i in server1 server2 server3 server4 do ssh $i done I know 'sed' could be used to... (5 Replies)
Discussion started by: momin
5 Replies

10. UNIX for Beginners Questions & Answers

Spooling File to My Desktop From Back-end using shell script

Hello all, I am trying to spool a SQL query output file from back-end to desktop in a certain path but it didn't work,the query writes the output in a file in the same directory at the back-end. note : i use the same query in sql developper and file was created in the desired path fine code... (1 Reply)
Discussion started by: bmaksoud
1 Replies
plot(1B)					     SunOS/BSD Compatibility Package Commands						  plot(1B)

NAME
plot, aedplot, atoplot, bgplot, crtplot, dumbplot, gigiplot, hpplot, implot, plottoa, t300, t300s, t4013, t450, tek, vplot, hp7221plot - graphics filters for various plotters SYNOPSIS
/usr/ucb/plot [-Tterminal] DESCRIPTION
The plot utility reads plotting instructions (see plot(4B)) from the standard input and produces plotting instructions suitable for a par- ticular terminal on the standard output. If no terminal is specified, the environment variable TERM is used. The default terminal is tek. ENVIRONMENT VARIABLES
Except for ver, the following terminal-types can be used with `lpr -g' (see lpr(1B)) to produce plotted output: 2648 | 2648a | h8 | hp2648 | hp2648a Hewlett Packard 2648 graphics terminal. hp7221 | hp7 | h7 | Hewlett Packard 7221 plotter. 300 DASI 300 or GSI terminal (Diablo mechanism). 300s | 300S DASI 300s terminal (Diablo mechanism). 450 DASI Hyterm 450 terminal (Diablo mechanism). 4013 Tektronix 4013 storage scope. 4014 | tek Tektronix 4014 and 4015 storage scope with Enhanced Graphics Module. (Use 4013 for Tektronix 4014 or 4015 without the Enhanced Graphics Module). aed AED 512 color graphics terminal. bgplot | bitgraph BBN bitgraph graphics terminal. crt Any crt terminal capable of running vi(1). dumb | un | unknown Dumb terminals without cursor addressing or line printers. gigi | vt125 DEC vt125 terminal. implot Imagen plotter. var Benson Varian printer-plotter ver Versatec D1200A printer-plotter. The output is scan-converted and suitable input to `lpr -v'. FILES
/usr/ucb/aedplot /usr/ucb/atoplot /usr/ucb/bgplot /usr/ucb/crtplot /usr/ucb/dumbplot /usr/ucb/gigiplot /usr/ucb/hp7221plot /usr/ucb/hpplot /usr/ucb/implot /usr/ucb/plot /usr/ucb/plottoa /usr/ucb/t300 /usr/ucb/t300s /usr/ucb/t4013 /usr/ucb/t450 /usr/ucb/tek /usr/ucb/vplot ATTRIBUTES
See attributes(5) for descriptions of the following attributes: +-----------------------------+-----------------------------+ | ATTRIBUTE TYPE | ATTRIBUTE VALUE | +-----------------------------+-----------------------------+ |Availability |SUNWscpu | +-----------------------------+-----------------------------+ SEE ALSO
graph(1), tplot(1), vi(1), lpr(1B), plot(4B), attributes(5) SunOS 5.11 3 Aug 1994 plot(1B)
All times are GMT -4. The time now is 11:59 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy