![]() |
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.
|
|
google unix.com
|
|||||||
| Forums | Register | Forum Rules | Links | Albums | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here. |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| problem with shell script execution | anju | Shell Programming and Scripting | 2 | 05-08-2008 01:50 AM |
| Remote commands problem using RSH & Rexec | fhuwaidy | UNIX for Advanced & Expert Users | 0 | 01-15-2008 04:22 PM |
| use two unix commands to solve the following problem | vicky20000 | UNIX for Advanced & Expert Users | 3 | 01-20-2007 06:35 PM |
| problem with directory commands | tej.buch | Shell Programming and Scripting | 1 | 01-23-2006 02:22 AM |
| Find & tar execution problem | ianf | Shell Programming and Scripting | 3 | 05-24-2002 09:40 AM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
||||
|
Problem while execution of second set of commands
Hi,
I have a shell script with code . perf.env cd $QRY_DIR for SHELL_FILE in sql1 do export SNAME=$SHELL_FILE ${SCRIPT_DIR}/perf_qry.sh ${SPOOL_DIR} ${DB_ENVNAME} ${NAME} & RC=$(expr ${RC:-0} + $? ) sleep 60 if [ $RC == 0 ] then echo sysdate>test1 echo query1.txt>>test1 grep -i selected sql_test.txt>>test1 grep -i elapsed sql_test.txt>>test1 awk '/rows selected/ { $0=$1 } /Elapsed/ { split($2, t, ":");$0=3600*t[0]+60*t[1 ]+'t[2]+.001*t[3]' }{ out=out sprintf("%s%s",NR==1?"":",","\047"$0"\047") }END{ print("insert into FDW_QUERY_TIME values ("out");") }' test1>test2 fi done exit $RC My problem is after executing the sql1 and the spooling is completed I want to execute the next bit of code after sleep.I actually want to grep the spooled file items.but before spooling is completed the command are executed. Can any one help me to correct this |
|
||||
|
It worked but still one doubt
Jim,
it worked.But I have one more doubt My Elapsed time is Elapsed: 00:00:26.42 So in seconds i should get 26.042 second.but as per this code I am getting it as 0.02642. Can you please tell me where I have made a mistake. Thanks |
|
||||
|
one more problem in the same code
I have further a problem with my code.
. perf.env cd $QRY_DIR for SHELL_FILE in sql1 sql2 do export SNAME=$SHELL_FILE ${SCRIPT_DIR}/perf_qry.sh ${SPOOL_DIR} ${DB_ENVNAME} ${NAME} RC=$(expr ${RC:-0} + $? ) if [ $RC == 0 ] then sel1='/selected/{p;q;}' sel2='/Elapsed/{p;q;}' for i in *.txt do TZ=`date +%Z` ; a=`date +%d-%b-%y` echo $a >$i_1 echo 1 >>$i_1 sed -n $sel1 $i >>$i_1 sed -n $sel2 $i >>$i_1 awk '/rows selected/ { $0=$1 } /Elapsed/ { split($2, t, ":");$0=3600*t[1]+60*t[2]+t[3] }{ out=out sprintf("%s%s",NR==1?"":",","\047"$0"\047") }END{ print(""out"") }' $i_1>$i_1_r done fi done exit $RC I am getting error unknown echo command.... and also while printing the out I do not want single quotes but need the fields seperated by commas only. And also I want to sqlldr user/pwd control=f1.ctl data=$i_1_r (i.e I want the $i_1_r files to be loaded to database) Please help me .. Last edited by ran16; 06-16-2008 at 12:09 PM.. |
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|