Extracting specific data from a text report

Hello,

I have a database statistic report that gets created every time my script runs to sample the many "counters" that are important to a database administrator.

What I want to do is take this further and extract data from the report in a CSV like format so that I can plug it into Excel and graph the values to better understand the big picture with charts.

Attached is a sample of the "report", this gets produced a few times per day on a 30 minute interval, so I have a directory with a bunch of files with the current time-stamp as the file-name..

perf-20100304-0705.txt
perf-20100304-0735.txt
perf-20100304-0805.txt
perf-20100304-0905.txt

Each file is identical to the attached example, except the counters (values) are different.

Now I want to extract that from each file in the directory in a comma separated format as per example:

20100304-0705,DB Reads,137366
20100304-0705,DB Writes,3428
20100304-0705,Record Reads,19581692

So if you are following, it would be [date][type of counter][value]

If someone could show me an example of how to do this, by scripting it or in excel or something.. or any other program out there that can do this.. that would be very helpful.

Thank you for your time.

perf-20100304-0705.txt
mirdeAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

BlackAdderDKCommented:
Hi

Need to see the output in a file to know how to format it ;)

regards
'Adder
0
yogi4lifeCommented:
Here is how it can be done in VBscript.
You will have to supply four parameters like this:


To create a CSV file named perf-20101201-0000..20101231-2359.csv with the three counters:


     MergeFiles I:\perfdata\   perf-   20101201-0000   20101231-2359

The CSV-file is TAB-delimited not comma delimited
ForReading = 1
ForWriting = 2
CSVdelim = chr(9)
PerfDataFolder = WScript.Arguments(0)
filePrefix = WScript.Arguments(1)
startTime = WScript.Arguments(2)
endTime = WScript.Arguments(3)
resultFile = PerfDataFolder & filePrefix & startTime & ".." & endTime & ".csv"

resultText = ReadPerfData(PerfDataFolder, startTime, endTime)
WriteIt resultFile, resultText

Function ReadOnePerf(FileName)
    Set fso = CreateObject("Scripting.FileSystemObject")
    Set MyFile = fso.OpenTextFile(FileName, ForReading)
    DateAndTime = Left(Right(FileName, 17), 13)
    If MyFile.AtEndOfStream Then
        s = ""
    Else
        s = MyFile.ReadAll
        DBreads = Trim(Mid(s, InStr(s, "|DB Reads") + 9, 18))
        DBwrites = Trim(Mid(s, InStr(s, "|DB Writes") + 10, 18))
        RecordReads = Trim(Mid(s, InStr(s, Chr(10) & "Record Reads") + 14, 15))
    End If
    ReadOnePerf = _
        DateAndTime & CSVdelim & "DB Reads" & CSVdelim & DBreads & vbCrLf & _
        DateAndTime & CSVdelim & "DB Writes" & CSVdelim & DBwrites & vbCrLf & _
        DateAndTime & CSVdelim & "Record Reads" & CSVdelim & RecordReads & vbCrLf
End Function

Sub WriteIt(f, s)
    Set fso = CreateObject("Scripting.FileSystemObject")
    Set MyFile = fso.OpenTextFile(f, ForWriting, True)
    MyFile.Write s
    MyFile.Close
End Sub

Function ReadPerfData(PerfDataFolder, startTime, endTime)
    Set fso = CreateObject("Scripting.FileSystemObject")
    
    Set Folder = fso.GetFolder(PerfDataFolder)
    
    Set allFiles = CreateObject("System.Collections.SortedList")
    For Each file In Folder.Files
        If ((UCase(Left(file.Name, 5)) = WScript.Arguments(1)) And (UCase(Right(file.Name, 4)) = ".TXT")) Then
            allFiles.Add file.Name, file.Name
        End If
    Next
    s = ""
    For i = 0 To allFiles.Count - 1
        DateAndTime = Left(Right(allFiles.GetByIndex(i), 17), 13)
        If (startTime <= DateAndTime) And (DateAndTime <= endTime) Then
            o = ReadOnePerf(PerfDataFolder & allFiles.GetByIndex(i))
            s = s + o
        End If
    Next
    ReadPerfData = s
End Function

Open in new window

0
yogi4lifeCommented:
If you prefer to do it on Linux or Mac - even Windows if you have the GNU Awk:

   gawk -f filters.awk perf-2010*.txt >myReport.csv

contents of filters.awk:
/\|DB Reads/ { print substr(FILENAME,6,13) ",DB Reads," $6 } 
/\|DB Writes/ { print substr(FILENAME,6,13) ",DB Writes," $6 } 
/^Record Reads/ { print substr(FILENAME,6,13) ",Record Reads," $3 }

Open in new window

0
OWASP Proactive Controls

Learn the most important control and control categories that every architect and developer should include in their projects.

yogi4lifeCommented:
By the way - it is very easy to adapt the VB Script code over to VBA code. Then it is easy to place the information into a spreadsheet and graph it directly without doing any CSV conversion...

- Petter
0
nicsaintCommented:
An alternative is the attached code - You can paste it straight into the Excel VBA Module
The code prompts for the data directory, imports each .txt file, delimits the data into columns, removes unnecessary columns and rows (not quite sure which data is required but can be adapted to suit), then creates and enters the date column. Finally the data is saved as a csv file with the same filename as the .txt file.
Let me know if you need help adapting it to suit.




Sub Delimit_Text()
 
Set MyFilePAth = CreateObject("Shell.Application").BrowseForFolder(0, "Please choose a folder", 0, OpenAt)
 myval = ShellApp
  MyFilePAth = MyFilePAth.self.Path
  myFileExt = "\*.txt"

    x = 0
    myFileName = Dir(MyFilePAth & myFileExt)
    Do While myFileName <> ""
        x = x + 1
        myFileList = myFileList & myFileName & ","
        myFileName = Dir()
    Loop
If Len(myFileList) = 0 Then
    MsgBox ("No .txt Files found in " & MyFilePAth)
    End
End If
    myFileList = Left(myFileList, Len(myFileList) - 1)
    myFileList = Split(myFileList, ",")
    
For Each MyFile In myFileList
myFileName = Left(MyFile, Len(MyFile) - 4)
myFileExt = Right(MyFile, 4)

    Workbooks.OpenText FileName:= _
        MyFilePAth & "\" & myFileName & myFileExt, _
        Origin:=437, StartRow:=1, DataType:=xlDelimited, TextQualifier:= _
        xlDoubleQuote, ConsecutiveDelimiter:=False, Tab:=False, Semicolon:=False _
        , Comma:=False, Space:=False, Other:=False, FieldInfo:=Array(1, 2), _
        TrailingMinusNumbers:=True
    Range("A1").Select
    Range(Selection, Selection.End(xlDown)).Select
    Range(Selection, ActiveCell.SpecialCells(xlLastCell)).Select
    For x = 1 To 20
    Selection.Replace What:="  ", Replacement:=",", LookAt:=xlPart, _
        SearchOrder:=xlByRows, MatchCase:=False, SearchFormat:=False, _
        ReplaceFormat:=False
    Selection.Replace What:=", ", Replacement:=",", LookAt:=xlPart, _
        SearchOrder:=xlByRows, MatchCase:=False, SearchFormat:=False, _
        ReplaceFormat:=False
    Selection.Replace What:=",,", Replacement:=",", LookAt:=xlPart, _
        SearchOrder:=xlByRows, MatchCase:=False, SearchFormat:=False, _
        ReplaceFormat:=False
    Selection.Replace What:="|", Replacement:=",", LookAt:=xlPart, _
        SearchOrder:=xlByRows, MatchCase:=False, SearchFormat:=False, _
        ReplaceFormat:=False
    Next
    
    Selection.TextToColumns Destination:=Range("A1"), DataType:=xlDelimited, _
        TextQualifier:=xlDoubleQuote, ConsecutiveDelimiter:=False, Tab:=False, _
        Semicolon:=False, Comma:=True, Space:=False, Other:=True, OtherChar:= _
        "|", FieldInfo:=Array(Array(1, 2), Array(2, 2), Array(3, 2), Array(4, 2), Array(5, 2), _
        Array(6, 2)), TrailingMinusNumbers:=True

    Columns("A:A").Select
    Selection.Insert Shift:=xlToRight, CopyOrigin:=xlFormatFromLeftOrAbove
    Range("A1").Value = myFileName
    Range("A1", "A" & ActiveCell.SpecialCells(xlLastCell).Row).FillDown
    
    Columns("A:G").EntireColumn.AutoFit
    Range("A1").Select
    For x = 1 To 5
    For Each mycell In Range("B1", "B" & ActiveCell.SpecialCells(xlLastCell).Row)
     If IsDate(mycell.Value) Or Len(mycell.Offset(0, 1).Value) = 0 Then
        Range(mycell.Address).Select
        Range(mycell.Address).EntireRow.Delete
     End If
    Next
    Next
    
    Columns("B:D").Delete Shift:=xlToLeft
    Columns("D:D").Delete Shift:=xlToLeft
    Rows("10:10").Select
    Range(Selection, Selection.End(xlDown)).Delete Shift:=xlUp
    Rows("1:2").Delete Shift:=xlUp
    
Application.DisplayAlerts = False
    
    ActiveSheet.SaveAs FileName:= _
        MyFilePAth & "\" & myFileName & ".CSV", _
        FileFormat:=xlCSV, CreateBackup:=False
    ActiveWorkbook.Close (False)

Application.DisplayAlerts = True
Next
End Sub

Open in new window

0
mirdeAuthor Commented:
yogi4life, I used your gawk sample and that works perfectly.

I do want to make use of the vb code you provided and implement it that way, do i need to have VB installed to make this happen?

Or do I just save that as a .vb ? (MergeFiles.vb) and pass the parameters through cmd?

This is someone that has never used or created vb stuff.. :)
0
yogi4lifeCommented:
The VB code I provided is correctly referred to as VBS or VBScript which is a standard installation of all Windows versions today and has been for a lot of years.

So - no - you do not need to install anything as long as you use a Windows computer...

You can start it from the command line like this:

      C:\> mergefiles.vbs    
             
              (you can actually drop the .vbs extension on mergefiles - as Windows recognize the file as
               an executable script)    


           Example:


      C:\> mergefiles.vbs C:\Files\ perf- 20100201-0000 20100430-2359

          This will merge all the files in "C:\Files\" folder and have a filename beginning with
          "perf-" and extension ".txt".

          It will present a result file with the merged content in a file called:

              perf-20100201-0000..20100430-2359.csv



0
mirdeAuthor Commented:
I tried to do it as per your example..

E:\container>merger.vbs E:\container\ perf- 20100304-0705 20100414-0935

It produces a file called:

perf-20100304-0705..20100414-0935.csv

But no data inside it.

The directory E:\container\ contains the .txt reports as in my previous example (the dir list is attached).

Each text file contains the exact same report, just different values for the numbers.


 Volume in drive E is Data
 Volume Serial Number is 1AC4-4875

 Directory of E:\container

04/14/10  12:23 PM    <DIR>          .
04/14/10  12:23 PM    <DIR>          ..
04/14/10  12:23 PM                 0 dir.txt
04/14/10  12:15 PM             2,143 merger.vbs
04/14/10  12:22 PM                 0 perf-20100304-0705..20100414-0935.csv
04/14/10  09:44 AM             8,244 perf-20100304-0705.txt
04/14/10  09:44 AM             8,243 perf-20100304-0735.txt
04/14/10  09:44 AM             8,244 perf-20100304-0805.txt
04/14/10  09:44 AM             8,243 perf-20100304-0835.txt
04/14/10  09:44 AM             8,244 perf-20100304-0905.txt
04/14/10  09:44 AM             8,243 perf-20100304-0935.txt
04/14/10  09:44 AM             8,244 perf-20100304-1005.txt
04/14/10  09:44 AM             8,243 perf-20100304-1035.txt
04/14/10  09:44 AM             8,244 perf-20100304-1105.txt
04/14/10  09:44 AM             8,243 perf-20100304-1135.txt
04/14/10  09:44 AM             8,244 perf-20100304-1205.txt
04/14/10  09:44 AM             8,243 perf-20100304-1235.txt
04/14/10  09:44 AM             8,244 perf-20100305-0705.txt
04/14/10  09:44 AM             8,243 perf-20100305-0735.txt
04/14/10  09:44 AM             8,244 perf-20100305-0805.txt
04/14/10  09:44 AM             8,243 perf-20100305-0835.txt
04/14/10  09:44 AM             8,244 perf-20100305-0905.txt
04/14/10  09:44 AM             8,243 perf-20100305-0935.txt
04/14/10  09:44 AM             8,244 perf-20100305-1005.txt
04/14/10  09:44 AM             8,243 perf-20100305-1035.txt
04/14/10  09:44 AM             8,244 perf-20100305-1105.txt
04/14/10  09:44 AM             8,243 perf-20100305-1135.txt
04/14/10  09:44 AM             8,244 perf-20100305-1205.txt
04/14/10  09:44 AM             8,243 perf-20100305-1235.txt
04/14/10  09:44 AM             8,244 perf-20100308-0705.txt
04/14/10  09:44 AM             8,243 perf-20100308-0735.txt
04/14/10  09:44 AM             8,244 perf-20100308-0805.txt
04/14/10  09:44 AM             8,243 perf-20100308-0835.txt
04/14/10  09:44 AM             8,244 perf-20100308-0905.txt
04/14/10  09:44 AM             8,243 perf-20100308-0935.txt
04/14/10  09:44 AM             8,244 perf-20100308-1005.txt
04/14/10  09:44 AM             8,243 perf-20100308-1035.txt
04/14/10  09:44 AM             8,244 perf-20100308-1105.txt
04/14/10  09:44 AM             8,243 perf-20100308-1135.txt
04/14/10  09:44 AM             8,244 perf-20100308-1205.txt
04/14/10  09:44 AM             8,243 perf-20100308-1235.txt
04/14/10  09:44 AM             8,244 perf-20100309-0705.txt
04/14/10  09:44 AM             8,243 perf-20100309-0735.txt
04/14/10  09:44 AM             8,244 perf-20100309-0805.txt
04/14/10  09:44 AM             8,243 perf-20100309-0835.txt
04/14/10  09:44 AM             8,244 perf-20100309-0905.txt
04/14/10  09:44 AM             8,243 perf-20100309-0935.txt
04/14/10  09:44 AM             8,244 perf-20100309-1005.txt
04/14/10  09:44 AM             8,243 perf-20100309-1035.txt
04/14/10  09:44 AM             8,244 perf-20100309-1105.txt
04/14/10  09:44 AM             8,243 perf-20100309-1135.txt
04/14/10  09:44 AM             8,244 perf-20100309-1205.txt
04/14/10  09:44 AM             8,243 perf-20100309-1235.txt
04/14/10  09:44 AM             8,244 perf-20100310-0705.txt
04/14/10  09:44 AM             8,243 perf-20100310-0735.txt
04/14/10  09:44 AM             8,244 perf-20100310-0805.txt
04/14/10  09:44 AM             8,243 perf-20100310-0835.txt
04/14/10  09:44 AM             8,244 perf-20100310-0905.txt
04/14/10  09:44 AM             8,243 perf-20100310-0935.txt
04/14/10  09:44 AM             8,244 perf-20100310-1005.txt
04/14/10  09:44 AM             8,243 perf-20100310-1035.txt
04/14/10  09:44 AM             8,244 perf-20100310-1105.txt
04/14/10  09:44 AM             8,243 perf-20100310-1135.txt
04/14/10  09:44 AM             8,244 perf-20100310-1205.txt
04/14/10  09:44 AM             8,243 perf-20100310-1235.txt
04/14/10  09:44 AM             8,244 perf-20100311-0705.txt
04/14/10  09:44 AM             8,243 perf-20100311-0735.txt
04/14/10  09:44 AM             8,244 perf-20100311-0805.txt
04/14/10  09:44 AM             8,243 perf-20100311-0835.txt
04/14/10  09:44 AM             8,244 perf-20100311-0905.txt
04/14/10  09:44 AM             8,243 perf-20100311-0935.txt
04/14/10  09:44 AM             8,244 perf-20100311-1005.txt
04/14/10  09:44 AM             8,243 perf-20100311-1035.txt
04/14/10  09:44 AM             8,244 perf-20100311-1105.txt
04/14/10  09:44 AM             8,243 perf-20100311-1135.txt
04/14/10  09:44 AM             8,244 perf-20100311-1205.txt
04/14/10  09:44 AM             8,243 perf-20100311-1235.txt
04/14/10  09:44 AM             8,244 perf-20100312-0705.txt
04/14/10  09:44 AM             8,243 perf-20100312-0735.txt
04/14/10  09:44 AM             8,244 perf-20100312-0805.txt
04/14/10  09:44 AM             8,243 perf-20100312-0835.txt
04/14/10  09:44 AM             8,244 perf-20100312-0905.txt
04/14/10  09:44 AM             8,243 perf-20100312-0935.txt
04/14/10  09:44 AM             8,244 perf-20100312-1005.txt
04/14/10  09:44 AM             8,243 perf-20100312-1035.txt
04/14/10  09:44 AM             8,244 perf-20100312-1105.txt
04/14/10  09:44 AM             8,243 perf-20100312-1135.txt
04/14/10  09:44 AM             8,244 perf-20100312-1205.txt
04/14/10  09:44 AM             8,243 perf-20100312-1235.txt
04/14/10  09:44 AM             8,244 perf-20100315-0705.txt
04/14/10  09:44 AM             8,243 perf-20100315-0735.txt
04/14/10  09:44 AM             8,244 perf-20100315-0805.txt
04/14/10  09:44 AM             8,243 perf-20100315-0835.txt
04/14/10  09:44 AM             8,244 perf-20100315-0905.txt
04/14/10  09:44 AM             8,243 perf-20100315-0935.txt
04/14/10  09:44 AM             8,244 perf-20100315-1005.txt
04/14/10  09:44 AM             8,243 perf-20100315-1035.txt
04/14/10  09:44 AM             8,244 perf-20100315-1105.txt
04/14/10  09:44 AM             8,243 perf-20100315-1135.txt
04/14/10  09:44 AM             8,244 perf-20100315-1205.txt
04/14/10  09:44 AM             8,243 perf-20100315-1235.txt
04/14/10  09:44 AM             8,244 perf-20100316-0705.txt
04/14/10  09:44 AM             8,243 perf-20100316-0735.txt
04/14/10  09:44 AM             8,244 perf-20100316-0805.txt
04/14/10  09:44 AM             8,243 perf-20100316-0835.txt
04/14/10  09:44 AM             8,244 perf-20100316-0905.txt
04/14/10  09:44 AM             8,243 perf-20100316-0935.txt
04/14/10  09:44 AM             8,244 perf-20100316-1005.txt
04/14/10  09:44 AM             8,243 perf-20100316-1035.txt
04/14/10  09:44 AM             8,244 perf-20100316-1105.txt
04/14/10  09:44 AM             8,243 perf-20100316-1135.txt
04/14/10  09:44 AM             8,244 perf-20100316-1205.txt
04/14/10  09:44 AM             8,243 perf-20100316-1235.txt
04/14/10  09:44 AM             8,244 perf-20100317-0705.txt
04/14/10  09:44 AM             8,243 perf-20100317-0735.txt
04/14/10  09:44 AM             8,244 perf-20100317-0805.txt
04/14/10  09:44 AM             8,243 perf-20100317-0835.txt
04/14/10  09:44 AM             8,244 perf-20100317-0905.txt
04/14/10  09:44 AM             8,243 perf-20100317-0935.txt
04/14/10  09:44 AM             8,244 perf-20100317-1005.txt
04/14/10  09:44 AM             8,243 perf-20100317-1035.txt
04/14/10  09:44 AM             8,244 perf-20100317-1105.txt
04/14/10  09:44 AM             8,243 perf-20100317-1135.txt
04/14/10  09:44 AM             8,244 perf-20100317-1205.txt
04/14/10  09:44 AM             8,243 perf-20100317-1235.txt
04/14/10  09:44 AM             8,244 perf-20100318-0705.txt
04/14/10  09:44 AM             8,243 perf-20100318-0735.txt
04/14/10  09:44 AM             8,244 perf-20100318-0805.txt
04/14/10  09:44 AM             8,243 perf-20100318-0835.txt
04/14/10  09:44 AM             8,244 perf-20100318-0905.txt
04/14/10  09:44 AM             8,243 perf-20100318-0935.txt
04/14/10  09:44 AM             8,244 perf-20100318-1005.txt
04/14/10  09:44 AM             8,243 perf-20100318-1035.txt
04/14/10  09:44 AM             8,244 perf-20100318-1105.txt
04/14/10  09:44 AM             8,243 perf-20100318-1135.txt
04/14/10  09:44 AM             8,244 perf-20100318-1205.txt
04/14/10  09:44 AM             8,243 perf-20100318-1235.txt
04/14/10  09:44 AM             8,244 perf-20100319-0705.txt
04/14/10  09:44 AM             8,243 perf-20100319-0735.txt
04/14/10  09:44 AM             8,244 perf-20100319-0805.txt
04/14/10  09:44 AM             8,243 perf-20100319-0835.txt
04/14/10  09:44 AM             8,244 perf-20100319-0905.txt
04/14/10  09:44 AM             8,243 perf-20100319-0935.txt
04/14/10  09:44 AM             8,244 perf-20100319-1005.txt
04/14/10  09:44 AM             8,243 perf-20100319-1035.txt
04/14/10  09:44 AM             8,244 perf-20100319-1105.txt
04/14/10  09:44 AM             8,243 perf-20100319-1135.txt
04/14/10  09:44 AM             8,244 perf-20100319-1205.txt
04/14/10  09:44 AM             8,243 perf-20100319-1235.txt
04/14/10  09:44 AM             8,244 perf-20100322-0705.txt
04/14/10  09:44 AM             8,243 perf-20100322-0735.txt
04/14/10  09:44 AM             8,244 perf-20100322-0805.txt
04/14/10  09:44 AM             8,243 perf-20100322-0835.txt
04/14/10  09:44 AM             8,244 perf-20100322-0905.txt
04/14/10  09:44 AM             8,243 perf-20100322-0935.txt
04/14/10  09:44 AM             8,244 perf-20100322-1005.txt
04/14/10  09:44 AM             8,243 perf-20100322-1035.txt
04/14/10  09:44 AM             8,244 perf-20100322-1105.txt
04/14/10  09:44 AM             8,243 perf-20100322-1135.txt
04/14/10  09:44 AM             8,244 perf-20100322-1205.txt
04/14/10  09:44 AM             8,243 perf-20100322-1235.txt
04/14/10  09:44 AM             8,244 perf-20100323-0705.txt
04/14/10  09:44 AM             8,243 perf-20100323-0735.txt
04/14/10  09:44 AM             8,244 perf-20100323-0805.txt
04/14/10  09:44 AM             8,243 perf-20100323-0835.txt
04/14/10  09:44 AM             8,244 perf-20100323-0905.txt
04/14/10  09:44 AM             8,243 perf-20100323-0935.txt
04/14/10  09:44 AM             8,244 perf-20100323-1005.txt
04/14/10  09:44 AM             8,243 perf-20100323-1035.txt
04/14/10  09:44 AM             8,244 perf-20100323-1105.txt
04/14/10  09:44 AM             8,243 perf-20100323-1135.txt
04/14/10  09:44 AM             8,244 perf-20100323-1205.txt
04/14/10  09:44 AM             8,243 perf-20100323-1235.txt
04/14/10  09:44 AM             8,244 perf-20100324-0705.txt
04/14/10  09:44 AM             8,243 perf-20100324-0735.txt
04/14/10  09:44 AM             8,244 perf-20100324-0805.txt
04/14/10  09:44 AM             8,243 perf-20100324-0835.txt
04/14/10  09:44 AM             8,244 perf-20100324-0905.txt
04/14/10  09:44 AM             8,243 perf-20100324-0935.txt
04/14/10  09:44 AM             8,244 perf-20100324-1005.txt
04/14/10  09:44 AM             8,243 perf-20100324-1035.txt
04/14/10  09:44 AM             8,244 perf-20100324-1105.txt
04/14/10  09:44 AM             8,243 perf-20100324-1135.txt
04/14/10  09:44 AM             8,244 perf-20100324-1205.txt
04/14/10  09:44 AM             8,243 perf-20100324-1235.txt
04/14/10  09:44 AM             8,244 perf-20100325-0705.txt
04/14/10  09:44 AM             8,243 perf-20100325-0735.txt
04/14/10  09:44 AM             8,244 perf-20100325-0805.txt
04/14/10  09:44 AM             8,243 perf-20100325-0835.txt
04/14/10  09:44 AM             8,244 perf-20100325-0905.txt
04/14/10  09:44 AM             8,243 perf-20100325-0935.txt
04/14/10  09:44 AM             8,244 perf-20100325-1005.txt
04/14/10  09:44 AM             8,243 perf-20100325-1035.txt
04/14/10  09:44 AM             8,243 perf-20100325-1105.txt
04/14/10  09:44 AM             8,243 perf-20100325-1135.txt
04/14/10  09:44 AM             8,244 perf-20100325-1205.txt
04/14/10  09:44 AM             8,243 perf-20100325-1235.txt
04/14/10  09:44 AM             8,244 perf-20100326-0705.txt
04/14/10  09:44 AM             8,243 perf-20100326-0735.txt
04/14/10  09:44 AM             8,244 perf-20100326-0805.txt
04/14/10  09:44 AM             8,243 perf-20100326-0835.txt
04/14/10  09:44 AM             8,244 perf-20100326-0905.txt
04/14/10  09:44 AM             8,243 perf-20100326-0935.txt
04/14/10  09:44 AM             8,244 perf-20100326-1005.txt
04/14/10  09:44 AM             8,243 perf-20100326-1035.txt
04/14/10  09:44 AM             8,244 perf-20100326-1105.txt
04/14/10  09:44 AM             8,243 perf-20100326-1135.txt
04/14/10  09:44 AM             8,244 perf-20100326-1205.txt
04/14/10  09:44 AM             8,243 perf-20100326-1235.txt
04/14/10  09:44 AM             8,244 perf-20100329-0705.txt
04/14/10  09:44 AM             8,243 perf-20100329-0735.txt
04/14/10  09:44 AM             8,244 perf-20100329-0805.txt
04/14/10  09:44 AM             8,244 perf-20100329-0835.txt
04/14/10  09:44 AM             8,244 perf-20100329-0905.txt
04/14/10  09:44 AM             8,243 perf-20100329-0935.txt
04/14/10  09:44 AM             8,244 perf-20100329-1005.txt
04/14/10  09:44 AM             8,243 perf-20100329-1035.txt
04/14/10  09:44 AM             8,244 perf-20100329-1105.txt
04/14/10  09:44 AM             8,243 perf-20100329-1135.txt
04/14/10  09:44 AM             8,244 perf-20100329-1205.txt
04/14/10  09:44 AM             8,243 perf-20100329-1235.txt
04/14/10  09:44 AM             8,244 perf-20100330-0705.txt
04/14/10  09:44 AM             8,243 perf-20100330-0735.txt
04/14/10  09:44 AM             8,244 perf-20100330-0805.txt
04/14/10  09:44 AM             8,243 perf-20100330-0835.txt
04/14/10  09:44 AM             8,244 perf-20100330-0905.txt
04/14/10  09:44 AM             8,243 perf-20100330-0935.txt
04/14/10  09:44 AM             8,244 perf-20100330-1005.txt
04/14/10  09:44 AM             8,243 perf-20100330-1035.txt
04/14/10  09:44 AM             8,244 perf-20100330-1105.txt
04/14/10  09:44 AM             8,243 perf-20100330-1135.txt
04/14/10  09:44 AM             8,244 perf-20100330-1205.txt
04/14/10  09:44 AM             8,243 perf-20100330-1235.txt
04/14/10  09:44 AM             8,244 perf-20100331-0705.txt
04/14/10  09:44 AM             8,243 perf-20100331-0735.txt
04/14/10  09:44 AM             8,243 perf-20100331-0805.txt
04/14/10  09:44 AM             8,243 perf-20100331-0835.txt
04/14/10  09:44 AM             8,244 perf-20100331-0905.txt
04/14/10  09:44 AM             8,243 perf-20100331-0935.txt
04/14/10  09:44 AM             8,244 perf-20100331-1005.txt
04/14/10  09:44 AM             8,243 perf-20100331-1035.txt
04/14/10  09:44 AM             8,244 perf-20100331-1105.txt
04/14/10  09:44 AM             8,243 perf-20100331-1135.txt
04/14/10  09:44 AM             8,244 perf-20100331-1205.txt
04/14/10  09:44 AM             8,243 perf-20100331-1235.txt
04/14/10  09:44 AM             8,244 perf-20100401-0705.txt
04/14/10  09:44 AM             8,243 perf-20100401-0735.txt
04/14/10  09:44 AM             8,244 perf-20100401-0805.txt
04/14/10  09:44 AM             8,243 perf-20100401-0835.txt
04/14/10  09:44 AM             8,244 perf-20100401-0905.txt
04/14/10  09:44 AM             8,243 perf-20100401-0935.txt
04/14/10  09:44 AM             8,244 perf-20100401-1005.txt
04/14/10  09:44 AM             8,243 perf-20100401-1035.txt
04/14/10  09:44 AM             8,244 perf-20100401-1105.txt
04/14/10  09:44 AM             8,243 perf-20100401-1135.txt
04/14/10  09:44 AM             8,244 perf-20100401-1205.txt
04/14/10  09:44 AM             8,243 perf-20100401-1235.txt
04/14/10  09:44 AM             8,244 perf-20100402-0705.txt
04/14/10  09:44 AM             8,243 perf-20100402-0735.txt
04/14/10  09:44 AM             8,244 perf-20100402-0805.txt
04/14/10  09:44 AM             8,243 perf-20100402-0835.txt
04/14/10  09:44 AM             8,244 perf-20100402-0905.txt
04/14/10  09:44 AM             8,243 perf-20100402-0935.txt
04/14/10  09:44 AM             8,244 perf-20100402-1005.txt
04/14/10  09:44 AM             8,243 perf-20100402-1035.txt
04/14/10  09:44 AM             8,244 perf-20100402-1105.txt
04/14/10  09:44 AM             8,243 perf-20100402-1135.txt
04/14/10  09:44 AM             8,244 perf-20100402-1205.txt
04/14/10  09:44 AM             8,243 perf-20100402-1235.txt
04/14/10  09:44 AM             8,244 perf-20100405-0705.txt
04/14/10  09:44 AM             8,243 perf-20100405-0735.txt
04/14/10  09:44 AM             8,244 perf-20100405-0805.txt
04/14/10  09:44 AM             8,243 perf-20100405-0835.txt
04/14/10  09:44 AM             8,244 perf-20100405-0905.txt
04/14/10  09:44 AM             8,243 perf-20100405-0935.txt
04/14/10  09:44 AM             8,244 perf-20100405-1005.txt
04/14/10  09:44 AM             8,243 perf-20100405-1035.txt
04/14/10  09:44 AM             8,244 perf-20100405-1105.txt
04/14/10  09:44 AM             8,243 perf-20100405-1135.txt
04/14/10  09:44 AM             8,244 perf-20100405-1205.txt
04/14/10  09:44 AM             8,243 perf-20100405-1235.txt
04/14/10  09:44 AM             8,244 perf-20100406-0705.txt
04/14/10  09:44 AM             8,243 perf-20100406-0735.txt
04/14/10  09:44 AM             8,244 perf-20100406-0805.txt
04/14/10  09:44 AM             8,243 perf-20100406-0835.txt
04/14/10  09:44 AM             8,244 perf-20100406-0905.txt
04/14/10  09:44 AM             8,243 perf-20100406-0935.txt
04/14/10  09:44 AM             8,244 perf-20100406-1005.txt
04/14/10  09:44 AM             8,243 perf-20100406-1035.txt
04/14/10  09:44 AM             8,244 perf-20100406-1105.txt
04/14/10  09:44 AM             8,243 perf-20100406-1135.txt
04/14/10  09:44 AM             8,244 perf-20100406-1205.txt
04/14/10  09:44 AM             8,243 perf-20100406-1235.txt
04/14/10  09:44 AM             8,244 perf-20100407-0705.txt
04/14/10  09:44 AM             8,243 perf-20100407-0735.txt
04/14/10  09:44 AM             8,244 perf-20100407-0805.txt
04/14/10  09:44 AM             8,243 perf-20100407-0835.txt
04/14/10  09:44 AM             8,244 perf-20100407-0905.txt
04/14/10  09:44 AM             8,243 perf-20100407-0935.txt
04/14/10  09:44 AM             8,244 perf-20100407-1005.txt
04/14/10  09:44 AM             8,243 perf-20100407-1035.txt
04/14/10  09:44 AM             8,244 perf-20100407-1105.txt
04/14/10  09:44 AM             8,243 perf-20100407-1135.txt
04/14/10  09:44 AM             8,244 perf-20100407-1205.txt
04/14/10  09:44 AM             8,243 perf-20100407-1235.txt
04/14/10  09:44 AM             8,244 perf-20100408-0705.txt
04/14/10  09:44 AM             8,243 perf-20100408-0735.txt
04/14/10  09:44 AM             8,244 perf-20100408-0805.txt
04/14/10  09:44 AM             8,243 perf-20100408-0835.txt
04/14/10  09:44 AM             8,244 perf-20100408-0905.txt
04/14/10  09:44 AM             8,243 perf-20100408-0935.txt
04/14/10  09:44 AM             8,244 perf-20100408-1005.txt
04/14/10  09:44 AM             8,243 perf-20100408-1035.txt
04/14/10  09:44 AM             8,244 perf-20100408-1105.txt
04/14/10  09:44 AM             8,244 perf-20100409-0705.txt
04/14/10  09:44 AM             8,243 perf-20100409-0735.txt
04/14/10  09:44 AM             8,244 perf-20100409-0805.txt
04/14/10  09:44 AM             8,243 perf-20100409-0835.txt
04/14/10  09:44 AM             8,244 perf-20100409-0905.txt
04/14/10  09:44 AM             8,243 perf-20100409-0935.txt
04/14/10  09:44 AM             8,244 perf-20100409-1005.txt
04/14/10  09:44 AM             8,243 perf-20100409-1035.txt
04/14/10  09:44 AM             8,244 perf-20100409-1105.txt
04/14/10  09:44 AM             8,243 perf-20100409-1135.txt
04/14/10  09:44 AM             8,244 perf-20100409-1205.txt
04/14/10  09:44 AM             8,243 perf-20100409-1235.txt
04/14/10  09:44 AM             8,244 perf-20100412-0705.txt
04/14/10  09:44 AM             8,243 perf-20100412-0735.txt
04/14/10  09:44 AM             8,244 perf-20100412-0805.txt
04/14/10  09:44 AM             8,243 perf-20100412-0835.txt
04/14/10  09:44 AM             8,244 perf-20100412-0905.txt
04/14/10  09:44 AM             8,243 perf-20100412-0935.txt
04/14/10  09:44 AM             8,244 perf-20100412-1005.txt
04/14/10  09:44 AM             8,244 perf-20100412-1035.txt
04/14/10  09:44 AM             8,244 perf-20100412-1105.txt
04/14/10  09:44 AM             8,243 perf-20100412-1135.txt
04/14/10  09:44 AM             8,244 perf-20100412-1205.txt
04/14/10  09:44 AM             8,243 perf-20100412-1235.txt
04/14/10  09:44 AM             8,244 perf-20100413-0705.txt
04/14/10  09:44 AM             8,243 perf-20100413-0735.txt
04/14/10  09:44 AM             8,244 perf-20100413-0805.txt
04/14/10  09:44 AM             8,243 perf-20100413-0835.txt
04/14/10  09:44 AM             8,244 perf-20100413-0905.txt
04/14/10  09:44 AM             8,243 perf-20100413-0935.txt
04/14/10  09:44 AM             8,244 perf-20100413-1005.txt
04/14/10  09:44 AM             8,243 perf-20100413-1035.txt
04/14/10  09:44 AM             8,244 perf-20100413-1105.txt
04/14/10  09:44 AM             8,243 perf-20100413-1135.txt
04/14/10  09:44 AM             8,244 perf-20100413-1205.txt
04/14/10  09:44 AM             8,243 perf-20100413-1235.txt
04/14/10  09:44 AM             8,244 perf-20100414-0705.txt
04/14/10  09:44 AM             8,243 perf-20100414-0735.txt
04/14/10  09:44 AM             8,244 perf-20100414-0805.txt
04/14/10  09:44 AM             8,243 perf-20100414-0835.txt
04/14/10  09:44 AM             8,244 perf-20100414-0905.txt
04/14/10  09:44 AM             8,243 perf-20100414-0935.txt
             354 File(s)      2,895,612 bytes
               2 Dir(s)  326,971,142,144 bytes free

Open in new window

0
yogi4lifeCommented:
Could you post two or three of your files - so I have some relevant test data... and I'll see what I find out...

Actually I also made another version of it with regular expressions....
0
mirdeAuthor Commented:
Sure, attached are 3 examples.

Once again, thanks for all your help.

perf-20100304-0705.txt
perf-20100304-0735.txt
perf-20100304-0805.txt
0
yogi4lifeCommented:
Found my "subtle" bug...

Her is a correct version....
merger.vbs
0
mirdeAuthor Commented:
Hi Yogi,

I tried your updated script.. my exact command is..

E:\container>merger.vbs E:\container\ perf- 20100304-0705 - 20100414-0935

The content of E:\container is a bunch of text files ranging from..

perf-20100304-0705.txt

to

perf-20100414-0935.txt

The output is a file in E:\container\ named "perf-20100304-0705..-.csv" but blank (0 bytes).

Any idea?

Thanks for your continuous help.
0
yogi4lifeCommented:
Your exact command above has a dash character between from date and to date.

You must remove that.

merger.vbs accepts exactly 4 parameters and with your extra dash you supply 5...

It should be:

E:\container>merger.vbs E:\container\ perf- 20100304-0705 20100414-0935
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
mirdeAuthor Commented:
works as expected, thank you.
0
yogi4lifeCommented:
I couldnt resist the temptation of making a Windows CMD batch file version of it either:

@echo off
for %%f in (%1) do (
	for /F "tokens=1,2,3 delims=-." %%t in (""%%f"") do (
		for /F "tokens=1-8" %%i in (%%f) do (
			if "%%l %%m"=="|DB Writes"   echo %%u-%%v,DB %%m,%%n
			if "%%l %%m"=="|DB Reads"    echo %%u-%%v,DB %%m %%n 
			if "%%i %%j"=="Record Reads" echo %%u-%%v,%%i %%j,%%k
		)
	)
)

Open in new window

0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Shell Scripting

From novice to tech pro — start learning today.