Guys,
I have a script which hits the database and pulls the information that I need into files. Now I want to format these files to make them easy to read.
The sample format of the file will be like....
<Start_of_File>
Header1 .....xsdfsfa...adfa......
Header2 ....afefas .aefaefsdf...
-------------------------------------------------
A1 as_p:xxxxxxxxx as_p:yyyyyyyyy as_p:zzzzzzzzz
A2 as_p:dskfjsjfsd as_p:sdfafjlaflkd
Header1 .....xsdfsfa...adfa......
Header2 ....afefas .aefaefsdf...
-------------------------------------------------
B1 as_p:xxxxxxxxx as_p:yyyyyyyyy as_p:zzzzzzzzz
B2 as_p:dskfjsjfsd as_p:sdfafjlaflkd
B3 as_p:dsoiugtoi as_p:woiuiosgsd as_p
wuewuu
Header1 .....xsdfsfa...adfa......
Header2 ....afefas .aefaefsdf...
-------------------------------------------------
C1 as_p:xxxxxxxxx as_p:yyyyyyyyy as_p:zzzzzzzzz
C2 as_p:dskfjsjfsd as_p:sdfafjlaflkd
C3
C4
C5
.
.
.
<End_of_file>
The number of fields in the above records which have "as_p" in them are variable (actual content apart from Hearders).
I would like the file to be formated as....
<Start_of_File>
Header1 .....xsdfsfa...adfa......
Header2 ....afefas .aefaefsdf...
-------------------------------------------------
A1
as_p:xxxxxxxxx
as_p:yyyyyyyyy
as_p:zzzzzzzzz
A2
as_p:dskfjsjfsd
as_p:sdfafjlaflkd
Header1 .....xsdfsfa...adfa......
Header2 ....afefas .aefaefsdf...
-------------------------------------------------
B1
as_p:xxxxxxxxx
as_p:yyyyyyyyy
as_p:zzzzzzzzz
B2
as_p:dskfjsjfsd
as_p:sdfafjlaflkd
B3
as_p:dsoiugtoi
as_p:woiuiosgsd
as_p
wuewuu
Header1 .....xsdfsfa...adfa......
Header2 ....afefas .aefaefsdf...
-------------------------------------------------
C1
as_p:xxxxxxxxx
as_p:yyyyyyyyy
as_p:zzzzzzzzz
C2
as_p:dskfjsjfsd
as_p:sdfafjlaflkd
C3
C4
C5
.
.
.
<End_of_file>
Basically I want to search the records which have 'as_p' in them and transpose all the fields in that record in one column. The rest of the records which don't have 'as_p' in them should be left untouched.
Thanks in advance.