VB Script needed: converting logs columns to rows

fono's Avatar, Join Date: May 2009
Newbie Member
Hi all, i have a bunch of log files that needs to be imported into a database for analysis but the logs comes in the following format:

****************************CDR 1****************************
CDR_TYPE: CallRec
callingNumber: 7590405
calledNumber: 7500820
answerTime: 00:03:39
releaseTime:00:07:34
callDuration: 235
************************************************** ***********

****************************CDR 2****************************
CDR_TYPE: MOSMSRecord
serviceCentre: (91)685750004
recordingEntity: (91)685750007
location: (LAC: 00 0A CELLID: 75 49)
messageReference: 31
originationTime: 2007-09-01 00:07:34 - 0B00
destinationNumber: (91)6857513394
************************************************** ***********

****************************CDR 3****************************
CDR_TYPE: CallRec
callingNumber: 7583021
calledNumber: 7552525
answerTime: 00:04:39
releaseTime: 00:07:37
callDuration: 178
************************************************** ***********

I need a script to output data in rows insted of columns filtering only data of CDR_TYPE: CallRec
Bottom line is, you just need to see if the call is of type "CallRec" & print out every line after the first ':' until you see a bunch of '*', then start over


The output should be :

CDR_TYPE callingNumber calledNumber answerTime releaseTime callDuration
CallRec 7590405 7500820 00:03:39 00:07:34 235
CallRec 7583021 7552525 00:04:39 00:07:37 178
......


Thanks in advance
fono
shabbir's Avatar, Join Date: Jul 2004
Go4Expert Founder
Moved to VBScript forum