How to format or create a matrix report from file

Dear Unix champs,

I have a input file as attached, i would like to create an report from the file as below
FileType | EQUENS0001 | EQUENS0002 | EQUENS1100 | EQUENS0003
--------+--------------------------------------------------------
Msg No | 20081219/00000006|20081219/00000007|20081219/00000005|-
20081219/00000015| | | |
I have AIX box, where i did (it will give me file type and message number)
grep -E "MESSAGE_ID|VSTR_KEY$GEN_VSTR_INDEX" filename
VSTR_KEY$GEN_VSTR_INDEX: <VSTR(80)S> "EQUENS0001C081222081222081222"
MESSAGE_ID: <MSG_ID(17)S> "20081219/00000006"
VSTR_KEY$GEN_VSTR_INDEX: <VSTR(80)S> "EQUENS0002C081222081222081222"
MESSAGE_ID: <MSG_ID(17)S> "20081219/00000007"
VSTR_KEY$GEN_VSTR_INDEX: <VSTR(80)S> "EQUENS1100C081222081222081222"
MESSAGE_ID: <MSG_ID(17)S> "20081219/00000005"
VSTR_KEY$GEN_VSTR_INDEX: <VSTR(80)S> "EQUENS0001C081222081222081222"
MESSAGE_ID: <MSG_ID(17)S> "20081219/00000015"
but now my problem is how I will extract next file type ?? if mulitiple messsage id s are present for that particular VSTR_KEY$GEN_VSTR_INDEX .

any update or any suggestion will be really appreciated.....

Maybe you could use grep -n to get the numbers of all lines specifying a file type, then process the source file "in parts", e.g. 10 lines down from every "grepped line" returned ... just an idea, though :rolleyes:

thank u so much for your idea and suggestion......i did the below method and able to extract the file in some manner ,
grep -E "VSTR_KEY$GEN_VSTR_INDEX|MESSAGE_ID" a.txt | awk -F" " '{print $4}'
"EQUENS0001C081222081222081222"
"20081219/00000006"
"EQUENS0002C081222081222081222"
"20081219/00000007"
"EQUENS1100C081222081222081222"
"20081219/00000005"
so now my query is can i format this o/p to below
"EQUENS0001C081222081222081222"-"20081219/00000006"
"EQUENS0002C081222081222081222"-"20081219/00000007"
"EQUENS1100C081222081222081222"-"20081219/00000005"