Change Columns to Rows
Posted: Sun Feb 20, 2005 3:23 pm
Hi,
I have a huge file in the following format:
------------------------ RECORD No. 1 -----------------------------------
Application Manager Id : 20
CDR Data Block Length : 548
Cdr version major/minor : 3 / 5
Cdr record type : 1 / (1=Voice, 2=Audit, 3=AtmPvc, 4=AtmSvc)
Cdr Category type : 0 / (0=Normal, 1=Usage Sensitive)
cdrTotalPage / cdrPage : 1 / 1
Call_ID / smInstance : 0x10586cc / 2920
Orig Incoming Signals : SETUP, RELCOMP, (101)
------------------------- RECORD No. 2 -----------------------------------
Application Manager Id : 20
CDR Data Block Length : 548
Cdr version major/minor : 3 / 5
Cdr record type : 1 / (1=Voice, 2=Audit, 3=AtmPvc, 4=AtmSvc)
Cdr Category type : 0 / (0=Normal, 1=Usage Sensitive)
cdrTotalPage / cdrPage : 1 / 1
Call_ID / smInstance : 0x1058716 / 6424
Orig Incoming Signals : SETUP, RELEASE, (81)
The problem is that each record comes out as rows and not in columns. Each record also contains close to 140 fields. At the end of each record, there are three blank lines before a new record starts. To be able to move the data into a database, I need to change the rows into columns. Ultimately, I would like the data to formatted with quotes surrounding each field and seperate by commas, shown as follows. The column headers can be eliminated as well.
"20","548","3 / 5","1 / (1=Voice, 2=Audit, 3=AtmPvc, 4=AtmSvc)","0 / (0=Normal, 1=Usage Sensitive)","1 / 1","0x10586cc / 2920","SETUP, RELCOMP, (101)"
"20","548","3 / 5","1 / (1=Voice, 2=Audit, 3=AtmPvc, 4=AtmSvc)","0 / (0=Normal, 1=Usage Sensitive)","1 / 1","0x1058716 / 6424","SETUP, RELEASE, (81)"
Any suggestions would be greatly appreciated. Thanks.
Khurram
I have a huge file in the following format:
------------------------ RECORD No. 1 -----------------------------------
Application Manager Id : 20
CDR Data Block Length : 548
Cdr version major/minor : 3 / 5
Cdr record type : 1 / (1=Voice, 2=Audit, 3=AtmPvc, 4=AtmSvc)
Cdr Category type : 0 / (0=Normal, 1=Usage Sensitive)
cdrTotalPage / cdrPage : 1 / 1
Call_ID / smInstance : 0x10586cc / 2920
Orig Incoming Signals : SETUP, RELCOMP, (101)
------------------------- RECORD No. 2 -----------------------------------
Application Manager Id : 20
CDR Data Block Length : 548
Cdr version major/minor : 3 / 5
Cdr record type : 1 / (1=Voice, 2=Audit, 3=AtmPvc, 4=AtmSvc)
Cdr Category type : 0 / (0=Normal, 1=Usage Sensitive)
cdrTotalPage / cdrPage : 1 / 1
Call_ID / smInstance : 0x1058716 / 6424
Orig Incoming Signals : SETUP, RELEASE, (81)
The problem is that each record comes out as rows and not in columns. Each record also contains close to 140 fields. At the end of each record, there are three blank lines before a new record starts. To be able to move the data into a database, I need to change the rows into columns. Ultimately, I would like the data to formatted with quotes surrounding each field and seperate by commas, shown as follows. The column headers can be eliminated as well.
"20","548","3 / 5","1 / (1=Voice, 2=Audit, 3=AtmPvc, 4=AtmSvc)","0 / (0=Normal, 1=Usage Sensitive)","1 / 1","0x10586cc / 2920","SETUP, RELCOMP, (101)"
"20","548","3 / 5","1 / (1=Voice, 2=Audit, 3=AtmPvc, 4=AtmSvc)","0 / (0=Normal, 1=Usage Sensitive)","1 / 1","0x1058716 / 6424","SETUP, RELEASE, (81)"
Any suggestions would be greatly appreciated. Thanks.
Khurram