VB Script needed: converting logs columns to rows

Discussion in 'JavaScript and AJAX' started by fono, May 5, 2009.

  1. fono

    fono New Member

    Joined:
    May 5, 2009
    Messages:
    1
    Likes Received:
    0
    Trophy Points:
    0
    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
     
  2. shabbir

    shabbir Administrator Staff Member

    Joined:
    Jul 12, 2004
    Messages:
    15,375
    Likes Received:
    389
    Trophy Points:
    83
    Moved to VBScript forum
     

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice