mysql -uroot -pxxx cmdb -e "select t_transaction.Id, t_transaction.name, descinfo,borntime,count, t_user.user from t_transaction,t_user where t_transaction.valid = 1 and t_transaction.owner = t_user.Id"| awk '{if(NR>1)print$0}'| awk '{if(NF==7)print$0}'| while read IDNAME DESC DATE TIME COUNT OWNER
do
NDIR="$TDIR/$ID"
mkdir -pv "$NDIR">/dev/null 2>&1
echo "$NAME">"$NDIR/name"
echo "$DESC">"$NDIR/descinfo"
echo "$DATE $TIME">"$NDIR/time"
echo "$COUNT">"$NDIR/count"
echo "$OWNER">"$NDIR/owner"
echo "$ID">>"$tfile"
done
cat "$tfile"| while read transid
do
NDIR="$TDIR/$transid"
mkdir -pv "$NDIR">/dev/null 2>&1
unlink "$NDIR/polist">/dev/null 2>&1
touch "$NDIR/polist"
if ["$transid"-lt"1"]
then
echo "error trans_id '$transid' ">> error.log
continue
fi
mysql -uroot -pxxx cmdb -e "select t_trans_pol.f_pol_id, t_trans_pol.idex, t_trans_pol.depd from t_trans_pol where t_trans_pol.f_tran_id = $transid and t_trans_pol.valid = 1 order by t_trans_pol.idex asc"| awk '{if(NR>1)print$0}'| while read pol idx depd