UPDATE
--- get all UPDATEs
awk '/^UPDATE /,/^\//' AE_AP_MATCH_999_0302143109.AET > xxx
--- combine multiple lines into 1 line
sed -n 'H;:a /^\/$/{x;s/\n//g;p;n;h;b a}' xxx > yyy
--- ignore temp tables
egrep -v '^UPDATE PS_.*_(T.*[0-9]|TAO) SET ' yyy
INSERT
grep ^INSERT AE_AP_MATCH_999_0302143109.AET| cut -d' ' -f3| egrep -v 'PS_.*_(T.*[0-9]|TAO)'