-
May 5th, 2009, 01:14 AM
#1
Script to convert logs columns to rows
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
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
-
May 5th, 2009, 02:16 AM
#2
Re: Script to convert logs columns to rows
Well, this is a place to get help with your code. Why don't you try it yourself, and post back when you either a)have the solution, or, b) have a problem
-
May 5th, 2009, 02:59 AM
#3
Re: Script to convert logs columns to rows
im newbie to VB thats why i came here
-
May 5th, 2009, 03:53 AM
#4
Re: Script to convert logs columns to rows
It seems you need everything after the first :
I would determine the position of the first : with an instr statement and store that into a variable
Than take the right$ of the line with the start being the position of the : and length the length of the line minus the position of the :
Code:
strline = "answerTime: 00:03:39 "
pos = instr(strline,":")
strWhatIWant = right$(strline,pos,len(strline)-pos-1)
something like this code, but I assume you fill strline not this way but using file IO
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|