mysql -uroot -pxxx cmdb -e "select t_trans_app.Id,t_trans_app.name, t_trans_app.f_trans_id, t_trans_app.timeval, t_trans_app.grp from t_trans_app where t_trans_app.valid = 1 and t_trans_app.status <> 4"| awk '{if(NR>1)print$0}'| awk '{if(NF==5)print$0}'| while read IDNAME TRANSID TIME GRP
do
NDIR="$APPDIR/$ID"
mkdir -pv "$NDIR">/dev/null 2>&1
echo "$NAME">"$NDIR/name"
echo "$TIME">"$NDIR/time"
echo "$GRP">"$NDIR/group"
echo "$TRANSID">"$NDIR/transid"
echo "$TRANSID $ID">>"$tmp_file"
done
cat "$tmp_file"| while read trans_id appid
do
NDIR="$APPDIR/$appid"
unlink "$NDIR/polist">/dev/null 2>&1
touch "$NDIR/polist"
if ["$trans_id"-lt"1"]
then
echo "error trans_id '$trans_id' ">> 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 = $trans_id and t_trans_pol.valid = 1 order by t_trans_pol.idex asc"| awk '{if(NR>1)print$0}'| while read pol idx depd