#!/bin/ksh
db_user=$DB_USER_NAME
db_pwd=$DB_PASSWORD
db_sid=$TWO_TASK
if [ $# -ne 1 ]; then
echo "\tUsage: MoveUsageProcessing <BC Log file Name>"
exit 1
else
BCLogFileName=$1
fi
grep -i 'MoveUsage daemon needs to run on this account before it can be billed' $1 |awk -F\| '{for(i=0;++i<=NF;) if($i ~ /Acct/) print substr($i,6)}' > ./$1.txt
echo " log file path is : './$1.txt' ";
sqlplus -s /nolog |&
print -p "connect $db_user/$db_pwd@$db_sid;"
print -p "SPOOL output.txt;"
while read var_ack_party_name
do
print -p "set pagesize 0 feedback off verify off heading off echo off linesize 100 \n"
print -p "select * from bus_event where ack_party_name like 'MOVE_USAGE_DAEMON%' and event_data_text like '%"$var_ack_party_name"%';"
done <./$1.txt
awk '/OrdAcctCycChg/ {print $1,substr($3,length($3),1)}' ./output.txt | while read a b
do
MoveUsageDaemon -r $b -i $b -e $a -p 1
done
the output when i ran this is :
atlvivd_on_burrow /tmp> newtrial.ksh 20111011.71BC.LOG
log file path is : './20111011.71BC.LOG.txt'
awk: can't open ./output.txt
The problem may be because of accessing output.txt file before it is getting created(because the query(in bold) is taking much time)
I need to wait till the query is executed completely...can anyone help me in this:(