sqlplus -s n1/n1 <<EOF set linesize 150 set pages 0 set feedback off spool check_$1.sh select 'ksh 12c.sh'||w||' '||t||' '||l||' '||rw||' '||rt||' '||rl||' ' from data where r=-1 and startdate='$1'; spool off; EOF ksh check_$1.sh |tee check_$1.log grep suggest check_$1.log |awk '{print $7" "$8" "$9" "$10" "$11" "$12" "$1" "$2" "$3" "$4" "$5" "$6}'>>filter_check.log cat filter_check.log function get_result { echo $1 sqlplus -s n1/n1 <<EOF set pages 0 select case when zhu>ke+1 then rpad('big win:',20)||to_number(w+rw)||' '||'$2'||','||'$3'||','||'$4'||','||'$5'||','||'$6'||','||'$7' when zhu=ke+1 then rpad('little win:',20)||to_number(w+rt)||' '||'$2'||','||'$3'||','||'$4'||','||'$5'||','||'$6'||','||'$7' when zhu=ke then rpad('tie:',20)||to_number(t+rl)||' '||'$2'||','||'$3'||','||'$4'||','||'$5'||','||'$6'||','||'$7' when zhu=ke-1 then rpad('little lose:',20)||to_number(l+rl)||' '||'$2'||','||'$3'||','||'$4'||','||'$5'||','||'$6'||','||'$7' when zhu<ke-1 then rpad('big lose:',20)||to_number(l+rl)||' '||'$2'||','||'$3'||','||'$4'||','||'$5'||','||'$6'||','||'$7' end end from data where startdate='$1' and w=$2 and t=$3 and l=$4 and rw=$5 and rt=$6 and rl=$7 order by (zhu-ke); EOF } while read line do echo ---start echo $line input_params=`echo $line|awk '{print $1" "$2" "$3" "$4" "$5" "$6}'` get_result $1 $input_params echo ....end echo . done <filter_check.log rm check_$1.log rm filter_check.log rm check_$1.sh |