perl or excel/vba for my app?

saimike

Senior member
Oct 30, 2000
393
0
0
hi guys,

i have 100MB (or bigger) text log files to analyse, and need to pluck certain variables/parameters from them and put them into an excel file.

the log files look kind of like this:

<time stamp> ms : <name of message>
<time stamp ms : <parameter 1> = <value 1>, <parameter 2> = <value 2>, ...
<time stamp ms : <parameter 3> = <value 3>, <parameter 4> = <value 4>, ...
<time stamp ms : <parameter 5> = <value 5> (<value 5 1st byte> = <value 5a>, <value 5 2nd byte> = <value 5b>
<time stamp ms : <parameter 8> = DTX, <parameter 9> = <value 9>, ...

sometimes parameters might be missing (eg. no parameter 7), or DTX (parameter 8).

would perl or excel/vba be a better way to extract the values i want from particular (or multiple types of ) messages?

we are using winxp at work so if perl were selected, we'd need to install it and the managers wouldnt like it. this is why i'm leaning towards vba since we all have excel installed. however, i'm no vba expert so if you guys have clever ideas (which commands/functions to use) i'd appreciate it.
 

TheKub

Golden Member
Oct 2, 2001
1,756
1
0
Im actually in a similar boat. We have a system that exports a comma delimited file and I need to be able to manipulate the information (such as breaking up a string containing a name and putting it into a firstname and lastname format). I need to make it as simple for the end user as possible, something like running a batch file..

What would be the best scripting language to do this in?
 

theknight571

Platinum Member
Mar 23, 2001
2,896
2
81
This can be done with VBA...

Some key commands are:

Open for opening a file for input/output

Close to close an opened file

Get or Input to read lines from the file

EOF check for end of file

InStr to locate the "delimiters"

Right$, Mid$, Left$ to obtain the values out of the string read in.

Do While.... Loop; While... Wend; Loop structures

Worksheets("WorksheetNAme").Cells(Row, Column).Value = <Variable> to put value into spreadsheet

You can look these commands up in the help file for some examples of how they're used.

Edit:

Added Code sample. It is close to what TheKub is looking for (less the parsing of the names).

It is also a quickie, and might be able to be done more efficiently, or cleanly.

Edit 2:

Added psedocode to the code window, to explain what's happening... which might be helpful if you're not familar with programming/vba... if you are... please ignore. :)