Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Output a line of text and the next 5 preceding lines

Status
Not open for further replies.
Oct 9, 2003
174
US
Im looking to write a vbscript that will grab some data out of an html report. I want to grab a particular line and the next preceding 5 lines.

The html report looks like this:
blah blah
blah blah
blah blah
<td valign="top" align="middle"><font face="verdana" size="2">0</td>
<td valign="top" align="middle"><font face="verdana" size="2">12</td>
<tr><td valign="top" align="middle" colspan="2"><font face="verdana" size="2">Total</td>
<td valign="top" align="middle"><font face="verdana" size="2">8,240,461,935</td>
<td valign="top" align="middle"><font face="verdana" size="2">&nbsp;</td>
<td valign="top" align="middle"><font face="verdana" size="2">431,584,277</td>
<td valign="top" align="middle"><font face="verdana" size="2">7,768,677,613</td>
</tr>
<tr><td valign="top" align="middle" colspan="2"><font face="verdana" size="2">Unknown</td>
<td valign="top" align="middle"><font face="verdana" size="2">40,200,045</td>
blah blah
blah blah
blah blah

What I was thinking was to write a script that would search for the text "<tr><td valign="top" align="middle" colspan="2"><font face="verdana" size="2">" in a particular report. Once that line is found, that will give me the first line that I want to output. My question is, How can I then tell the script to output the next 5 lines of data but nothing else?
 
What have you tried so far and where in your code are you stuck ?

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top