I am attempting to extract a few strings from a json data text file. The catch is that the info I need is not under unique headers and is nested. As you can see from the below sample, each blocksize has 3 iothroughput numbers. How do I go about retrieving them? I can search for a string and return a row number, but I am unable to consistently get the correct data and its corresponding block size.
blocksize:16kb
initial:
iothroughput:500
overwrite:
iothroughput:1000
read:
iothroughput:2000
blocksize:64MB
initial:
iothroughput:10
overwrite:
iothroughput:20
read:
iothroughput:30
So far, I have the following which searches for a string and returns the line. I would like to then begin another search at that point for "initial", return that line number, and search for "iothroughput" and pull that value into a cell.
Sub Import_File()
MsgBox ("Please Insert Data Contention File")
myFile = Application.GetOpenFilename()
Open myFile For Input As #1
Do Until EOF(1)
Line Input #1, textline
Text = Text & textline
Dim Ctr, Ctr2, Str
Ctr = Ctr + 1
Str = 16777216
If textline Like "*" & "" & Str & "" & "*" Then
Ctr2 = Ctr
Range("E4").Value = Ctr2
End If
Loop
Close #1