Right, and you expect us to write this script for you from scratch ? I think you should at least take a stab at it first.
For the field separator, use
Code:
awk -F'|'
or
awk -F\|
Then just write some if statements for all the conditions you stated in that order, knowing that field 1 is $1, field 2 is $2, etc.
See here for more help:
http://www.grymoire.com/Unix/Awk.html