| View previous topic :: View next topic |
| Author |
Message |
Rubes_sw Valued Contributor


Joined: 11 Jun 2001 Posts: 625 Location: Northern Ireland
|
Posted: Wed May 21, 2003 3:00 pm Post subject: Help on Deleteing Code ! |
|
|
OK, i am making a program that downloads a html file (Statistics).
I want to load it into a list and strip out the following line, so it does not show the graphic, or chart.
Line to remove:
| Quote: | | <IMG SRC="http://81.21.65.139/stats.asp?node=114860&server=18&file=daily_usage_200304" ALT="Daily usage for April 2003" HEIGHT=400 WIDTH=512> |
From the following code:
| Quote: |
<td width="79%" valign="top"> <span class="page_title">Usage Statistics</span>
<p><p><span class="sub_title">Monthly Statistics for April 2003</span><table border=0 cellPadding=2 cellSpacing=2 width=100%><TR><TD class=table_top>Total Hits</TD><TD class=table ALIGN=right>84</TD></TR><TR><TD class=table_top>Total Files</TD><TD class=table ALIGN=right>48</TD></TR><TR><TD class=table_top>Total Pages</TD><TD class=table ALIGN=right>69</TD></TR><TR><TD class=table_top>Total Visits</TD><TD class=table ALIGN=right>68</TD></TR><TR><TD class=table_top>Total KBytes</TD><TD class=table ALIGN=right>149</TD></TR><TR><TD class=table_top>Total Unique Sites</TD><TD class=table ALIGN=right>59</TD></TR><TR><TD class=table_top>Total Unique URLs</TD><TD class=table ALIGN=right>1</TD></TR><TR><TD class=table_top>Total Unique Referrers</TD><TD class=table ALIGN=right>2</TD></TR><TR><TD class=table_top>Total Unique User Agents</TD><TD class=table ALIGN=right>11</TD></TR></TABLE></p><IMG SRC="http://81.21.65.139/stats.asp?node=114860&server=18&file=daily_usage_200304" ALT="Daily usage for April 2003" HEIGHT=400 WIDTH=512><P><p><span class="sub_title">Daily Statistics for April 2003</span><table border=0 cellPadding=2 cellSpacing=2 width=100%><TR class=table_top><TD>Day</TD><TD>Hits</TD><TD>Files</TD><TD>Pages</TD><TD>Visits</TD><TD>Sites</TD><TD>KBytes</TD></TR><TR class=table><TD>4</TD><TD>2 (2.38%)</TD><TD>0 (0.00%)</TD><TD>1 (1.45%)</TD><TD>1 (1.47%)</TD><TD>1 (1.69%)</TD><TD>4 (2.97%)</TD></TR><TR class=table><TD>5</TD><TD>4 (4.76%)</TD><TD>0 (0.00%)</TD><TD>3 (4.35%)</TD><TD>3 (4.41%)</TD><TD>4 (6.78%)</TD><TD>9 (5.92%)</TD></TR><TR class=table><TD>6</TD><TD>4 (4.76%)</TD><TD>0 (0.00%)</TD><TD>3 (4.35%)</TD><TD>3 (4.41%)</TD><TD>3 (5.08%)</TD><TD>9 (5.90%)</TD></TR><TR class=table><TD>7</TD><TD>6 (7.14%)</TD><TD>3 (6.25%)</TD><TD>6 (8.70%)</TD><TD>6 (8.82%)</TD><TD>5 (8.47%)</TD><TD>3 (2.31%)</TD></TR><TR class=table><TD>8</TD><TD>3 (3.57%)</TD><TD>3 (6.25%)</TD><TD>3 (4.35%)</TD><TD>3 (4.41%)</TD><TD>3 (5.08%)</TD><TD>2 (1.66%)</TD></TR><TR class=table><TD>9</TD><TD>2 (2.38%)</TD><TD>2 (4.17%)</TD><TD>2 (2.90%)</TD><TD>2 (2.94%)</TD><TD>2 (3.39%)</TD><TD>2 (1.11%)</TD></TR><TR class=table><TD>10</TD><TD>2 (2.38%)</TD><TD>2 (4.17%)</TD><TD>2 (2.90%)</TD><TD>2 (2.94%)</TD><TD>2 (3.39%)</TD><TD>2 (1.11%)</TD></TR><TR class=table><TD>11</TD><TD>8 (9.52%)</TD><TD>4 (8.33%)</TD><TD>5 (7.25%)</TD><TD>5 (7.35%)</TD><TD>6 (10.17%)</TD><TD>20 (13.20%)</TD></TR><TR class=table><TD>12</TD><TD>5 (5.95%)</TD><TD>3 (6.25%)</TD><TD>4 (5.80%)</TD><TD>4 (5.88%)</TD><TD>4 (6.78%)</TD><TD>7 (4.54%)</TD></TR><TR class=table><TD>13</TD><TD>3 (3.57%)</TD><TD>2 (4.17%)</TD><TD>2 (2.90%)</TD><TD>2 (2.94%)</TD><TD>2 (3.39%)</TD><TD>6 (3.85%)</TD></TR><TR class=table><TD>14</TD><TD>1 (1.19%)</TD><TD>1 (2.08%)</TD><TD>1 (1.45%)</TD><TD>1 (1.47%)</TD><TD>1 (1.69%)</TD><TD>1 (0.55%)</TD></TR><TR class=table><TD>15</TD><TD>2 (2.38%)</TD><TD>2 (4.17%)</TD><TD>2 (2.90%)</TD><TD>2 (2.94%)</TD><TD>2 (3.39%)</TD><TD>2 (1.11%)</TD></TR><TR class=table><TD>16</TD><TD>1 (1.19%)</TD><TD>1 (2.08%)</TD><TD>1 (1.45%)</TD><TD>1 (1.47%)</TD><TD>1 (1.69%)</TD><TD>1 (0.55%)</TD></TR><TR class=table><TD>17</TD><TD>2 (2.38%)</TD><TD>2 (4.17%)</TD><TD>2 (2.90%)</TD><TD>2 (2.94%)</TD><TD>2 (3.39%)</TD><TD>2 (1.11%)</TD></TR><TR class=table><TD>18</TD><TD>3 (3.57%)</TD><TD>3 (6.25%)</TD><TD>3 (4.35%)</TD><TD>3 (4.41%)</TD><TD>3 (5.08%)</TD><TD>2 (1.68%)</TD></TR><TR class=table><TD>19</TD><TD>3 (3.57%)</TD><TD>3 (6.25%)</TD><TD>3 (4.35%)</TD><TD>3 (4.41%)</TD><TD>3 (5.08%)</TD><TD>3 (1.68%)</TD></TR><TR class=table><TD>20</TD><TD>4 (4.76%)</TD><TD>2 (4.17%)</TD><TD>3 (4.35%)</TD><TD>3 (4.41%)</TD><TD>4 (6.78%)</TD><TD>10 (6.59%)</TD></TR><TR class=table><TD>21</TD><TD>0 (0.00%)</TD><TD>0 (0.00%)</TD><TD>0 (0.00%)</TD><TD>0 (0.00%)</TD><TD>0 (0.00%)</TD><TD>0 (0.00%)</TD></TR><TR class=table><TD>22</TD><TD>5 (5.95%)</TD><TD>5 (10.42%)</TD><TD>5 (7.25%)</TD><TD>5 (7.35%)</TD><TD>5 (8.47%)</TD><TD>4 (2.79%)</TD></TR><TR class=table><TD>23</TD><TD>1 (1.19%)</TD><TD>1 (2.08%)</TD><TD>1 (1.45%)</TD><TD>1 (1.47%)</TD><TD>1 (1.69%)</TD><TD>1 (0.55%)</TD></TR><TR class=table><TD>24</TD><TD>9 (10.71%)</TD><TD>3 (6.25%)</TD><TD>7 (10.14%)</TD><TD>6 (8.82%)</TD><TD>5 (8.47%)</TD><TD>27 (18.13%)</TD></TR><TR class=table><TD>25</TD><TD>4 (4.76%)</TD><TD>1 (2.08%)</TD><TD>3 (4.35%)</TD><TD>3 (4.41%)</TD><TD>2 (3.39%)</TD><TD>13 (8.80%)</TD></TR><TR class=table><TD>26</TD><TD>4 (4.76%)</TD><TD>1 (2.08%)</TD><TD>2 (2.90%)</TD><TD>2 (2.94%)</TD><TD>4 (6.78%)</TD><TD>13 (8.78%)</TD></TR><TR class=table><TD>27</TD><TD>0 (0.00%)</TD><TD>0 (0.00%)</TD><TD>0 (0.00%)</TD><TD>0 (0.00%)</TD><TD>0 (0.00%)</TD><TD>0 (0.00%)</TD></TR><TR class=table><TD>28</TD><TD>2 (2.38%)</TD><TD>2 (4.17%)</TD><TD>2 (2.90%)</TD><TD>2 (2.94%)</TD><TD>2 (3.39%)</TD><TD>2 (1.11%)</TD></TR><TR class=table><TD>29</TD><TD>3 (3.57%)</TD><TD>1 (2.08%)</TD><TD>2 (2.90%)</TD><TD>2 (2.94%)</TD><TD>2 (3.39%)</TD><TD>5 (3.44%)</TD></TR><TR class=table><TD>30</TD><TD>1 (1.19%)</TD><TD>1 (2.08%)</TD><TD>1 (1.45%)</TD><TD>1 (1.47%)</TD><TD>1 (1.69%)</TD><TD>1 (0.55%)</TD></TR></TABLE></p><A NAME="HOURSTATS"></A><IMG SRC="http://81.21.65.139/stats.asp?node=114860&server=18&file=hourly_usage_200304" ALT="Hourly usage for April 2003" HEIGHT=256 WIDTH=512><P><p><span class="sub_title">Hourly Statistics for April 2003</span><table border=0 cellPadding=2 cellSpacing=2 width=100%><TR class=table_top><TD>Hour</TD><TD>Hits</TD><TD>Files</TD><TD>Pages</TD><TD>KBytes</TD></TR><TR class=table><TD>0</TD><TD>2 (2.38%)</TD><TD>0 (0.00%)</TD><TD>0 (0.00%)</TD><TD>8 (5.50%)</TD><TR class=table><TD>1</TD><TD>4 (4.76%)</TD><TD>4 (8.33%)</TD><TD>4 (5.80%)</TD><TD>3 (2.22%)</TD><TR class=table><TD>2</TD><TD>4 (4.76%)</TD><TD>1 (2.08%)</TD><TD>2 (2.90%)</TD><TD>13 (8.78%)</TD><TR class=table><TD>3</TD><TD>8 (9.52%)</TD><TD>3 (6.25%)</TD><TD>5 (7.25%)</TD><TD>19 (12.84%)</TD><TR class=table><TD>4</TD><TD>5 (5.95%)</TD><TD>3 (6.25%)</TD><TD>4 (5.80%)</TD><TD>11 (7.16%)</TD><TR class=table><TD>5</TD><TD>7 (8.33%)</TD><TD>2 (4.17%)</TD><TD>6 (8.70%)</TD><TD>15 (9.79%)</TD><TR class=table><TD>6</TD><TD>4 (4.76%)</TD><TD>3 (6.25%)</TD><TD>3 (4.35%)</TD><TD>7 (4.42%)</TD><TR class=table><TD>7</TD><TD>2 (2.38%)</TD><TD>2 (4.17%)</TD><TD>2 (2.90%)</TD><TD>2 (1.11%)</TD><TR class=table><TD>8</TD><TD>3 (3.57%)</TD><TD>2 (4.17%)</TD><TD>3 (4.35%)</TD><TD>6 (3.85%)</TD><TR class=table><TD>9</TD><TD>4 (4.76%)</TD><TD>2 (4.17%)</TD><TD>4 (5.80%)</TD><TD>2 (1.52%)</TD><TR class=table><TD>10</TD><TD>0 (0.00%)</TD><TD>0 (0.00%)</TD><TD>0 (0.00%)</TD><TD>0 (0.00%)</TD><TR class=table><TD>11</TD><TD>3 (3.57%)</TD><TD>3 (6.25%)</TD><TD>3 (4.35%)</TD><TD>3 (1.68%)</TD><TR class=table><TD>12</TD><TD>1 (1.19%)</TD><TD>0 (0.00%)</TD><TD>1 (1.45%)</TD><TD>0 (0.13%)</TD><TR class=table><TD>13</TD><TD>7 (8.33%)</TD><TD>2 (4.17%)</TD><TD>5 (7.25%)</TD><TD>18 (12.30%)</TD><TR class=table><TD>14</TD><TD>2 (2.38%)</TD><TD>2 (4.17%)</TD><TD>2 (2.90%)</TD><TD>2 (1.11%)</TD><TR class=table><TD>15</TD><TD>4 (4.76%)</TD><TD>2 (4.17%)</TD><TD>4 (5.80%)</TD><TD>6 (4.08%)</TD><TR class=table><TD>16</TD><TD>7 (8.33%)</TD><TD>5 (10.42%)</TD><TD>6 (8.70%)</TD><TD>8 (5.64%)</TD><TR class=table><TD>17</TD><TD>0 (0.00%)</TD><TD>0 (0.00%)</TD><TD>0 (0.00%)</TD><TD>0 (0.00%)</TD><TR class=table><TD>18</TD><TD>4 (4.76%)</TD><TD>4 (8.33%)</TD><TD>4 (5.80%)</TD><TD>3 (2.23%)</TD><TR class=table><TD>19</TD><TD>3 (3.57%)</TD><TD>2 (4.17%)</TD><TD>2 (2.90%)</TD><TD>6 (3.85%)</TD><TR class=table><TD>20</TD><TD>4 (4.76%)</TD><TD>1 (2.08%)</TD><TD>3 (4.35%)</TD><TD>9 (6.26%)</TD><TR class=table><TD>21</TD><TD>2 (2.38%)</TD><TD>2 (4.17%)</TD><TD>2 (2.90%)</TD><TD>2 (1.11%)</TD><TR class=table><TD>22</TD><TD>2 (2.38%)</TD><TD>1 (2.08%)</TD><TD>2 (2.90%)</TD><TD>5 (3.31%)</TD><TR class=table><TD>23</TD><TD>2 (2.38%)</TD><TD>2 (4.17%)</TD><TD>2 (2.90%)</TD><TD>2 (1.11%)</TD></TABLE></p><A NAME="TOPURLS"></A><p><span class="sub_title">Request Report</span><table border=0 cellPadding=2 cellSpacing=2 width=100%><TR class=table_top><TD>#</TD><TD>Hits</TD><TD>KBytes</TD><TD>URL</TD></TR><TR class=table><TD>1</TD><TD>50 (59.52%)</TD><TD>40 (26.96%)</TD><TD NOWRAP>/default.htm</TD></TR></TABLE></p><p><span class="sub_title">Request Report</span><table border=0 cellPadding=2 cellSpacing=2 width=100%><TR class=table_top><TD>#</TD><TD>Hits</TD><TD>KBytes</TD><TD>URL</TD></TR><TR class=table><TD>1</TD><TD>50 (59.52%)</TD><TD>40 (26.96%)</TD><TD NOWRAP>/default.htm</TD></TR></TABLE></p><A NAME="TOPENTRY"></A><p><span class="sub_title">Top 1 of 1 Total Entry Pages</span><table border=0 cellPadding=2 cellSpacing=2 width=100%><TR class=table_top><TD>#</TD><TD>Hits</TD><TD>Visits</TD><TD>URL</TD></TR><TR class=table><TD>1</TD><TD>50 (59.52%)</TD><TD>50 (100.00%)</TD><TD NOWRAP>/default.htm</TD></TR></TABLE></p><A NAME="TOPEXIT"></A><p><span class="sub_title">Top 1 of 1 Total Exit Pages</span><table border=0 cellPadding=2 cellSpacing=2 width=100%><TR class=table_top><TD>#</TD><TD>Hits</TD><TD>Visits</TD><TD>URL</TD></TR><TR class=table><TD>1</TD><TD>50 (59.52%)</TD><TD>49 (100.00%)</TD><TD NOWRAP>/default.htm</TD></TR></TABLE></p><A NAME="TOPREFS"></A><p><span class="sub_title">Top 2 of 2 Total Referrers</span><table border=0 cellPadding=2 cellSpacing=2 width=100%><TR class=table_top><TD>#</TD><TD>Hits</TD><TD>Referrer</TD></TR><TR class=table><TD>1</TD><TD>2 (2.38%)</TD><TD NOWRAP>http://www.miragorobot.com/scripts/mrinfo.asp</TD></TR><TR class=table><TD>2</TD><TD>1 (1.19%)</TD><TD NOWRAP>http://www.seriouslyfunny.net/Links.htm</TD></TR></TABLE></p><A NAME="TOPAGENTS"></A><p><span class="sub_title">Top 11 of 11 Total User Agents</span><table border=0 cellPadding=2 cellSpacing=2 width=100%><TR class=table_top><TD>#</TD><TD>Hits</TD><TD>User Agent</TD></TR><TR class=table><TD>1</TD><TD>42 (50.00%)</TD><TD NOWRAP>+grub-client-1</TD></TR><TR class=table><TD>2</TD><TD>8 (9.52%)</TD><TD NOWRAP>Mozilla/5</TD></TR><TR class=table><TD>3</TD><TD>6 (7.14%)</TD><TD NOWRAP>+Ask+Jeeves/Teoma)</TD></TR><TR class=table><TD>4</TD><TD>6 (7.14%)</TD><TD NOWRAP>+MSIE+5</TD></TR><TR class=table><TD>5</TD><TD>6 (7.14%)</TD><TD NOWRAP>Googlebot/2.1+(+http://www.googlebot.com/bot.html)</TD></TR><TR class=table><TD>6</TD><TD>4 (4.76%)</TD><TD NOWRAP>+MSIE+6</TD></TR><TR class=table><TD>7</TD><TD>4 (4.76%)</TD><TD NOWRAP>ia_archiver</TD></TR><TR class=table><TD>8</TD><TD>3 (3.57%)</TD><TD NOWRAP>FAST-WebCrawler/3.8+(atw-crawler+at+fast+dot+no;+http://fast.no/support/crawler.asp)</TD></TR><TR class=table><TD>9</TD><TD>2 (2.38%)</TD><TD NOWRAP>HenryTheMiragoRobot</TD></TR><TR class=table><TD>10</TD><TD>2 (2.38%)</TD><TD NOWRAP>Openfind+data+gatherer,+Openbot/3.0+(robot-response@openfind.com.tw;+http://www.openfind.com/robot.html)</TD></TR><TR class=table><TD>11</TD><TD>1 (1.19%)</TD><TD NOWRAP>Scooter/3.3</TD></TR></TABLE></p></p> |
However the following may change:
eg.
| Quote: | | ><IMG SRC="http://81.21.65.139/stats.asp?node=114860&server=18&file=daily_usage_200304" ALT="Daily usage for April 2003" HEIGHT=400 WIDTH=512> |
the node=114860 (may change)
file=daily_usage_200304
ALT="Daily usage for April 2003"
An code examples would be great !
The above code is part of a bigger HTML file, although i can already strip out the code i do not want. The above problem has me baffled
Nathan |
|
| Back to top |
|
 |
Dr. Dread Professional Member


Joined: 03 Aug 2001 Posts: 1065 Location: Copenhagen, Denmark
|
Posted: Wed May 21, 2003 3:32 pm Post subject: |
|
|
I hope I've got your intentions right...
Wouldn't it be nice if VDS had built-in regular expressions??
But try this:
* Get your HTML text into the variable %%htmltxt
* and then run that through this code:
| Code: |
%%string1 = "<IMG SRC="@CHR(34)"http://81.21.65.139/stats.asp?node="
%%string2 = "HEIGHT=400 WIDTH=512>"
%%htmltxt = @strdel(%%htmltxt,@pos(%%string1,%%htmltxt),@sum(@pos(%%string2,%%htmltxt),@pred(@len(%%string2))))
|
Greetz
Dr. Dread _________________ ~~ Alcohol and calculus don't mix... Don't drink and derive! ~~
String.DLL * advanced string processing
Last edited by Dr. Dread on Wed May 21, 2003 3:51 pm; edited 1 time in total |
|
| Back to top |
|
 |
moke Contributor

Joined: 02 Jan 2002 Posts: 162
|
Posted: Wed May 21, 2003 3:33 pm Post subject: |
|
|
Hi Nathan,
I don't have a complete code example for you but I'll try to give you the general Idea. You might be able to use binfile, but i've used VDSINOUT.DLL to accomplish this type of task.
Basically you use the dll to search from the begining of the file to the first occurace of a given string and extract a piece of the file to a temp file (This will cut & paste the data to a new file from the beggining to the start of the string in question):
| Code: |
%%P1 = 1
%%P2 = @IO(FPOSC,FILE2SEARCH,1,,<IMG SRC="http://81.21.65.139/stats.asp?)
%%extract = @IO(XTRCT,FILE@SEARCH,%%P1,%%P2,NEWHTMLFILENAME
|
Then search starting from the last position (%%P2) or in this case maybe "WIDTH=512>" repeat this finding, extracting & saving only the info you want and append your temp file unsing the append function in the DLL.
Sorry I can't give you more details but it's a little time consuming. If you try this method and have questions though I wil try to help if I can.
Good Luck!
moke |
|
| Back to top |
|
 |
moke Contributor

Joined: 02 Jan 2002 Posts: 162
|
Posted: Wed May 21, 2003 3:40 pm Post subject: |
|
|
I think Dr. Dread's method will work much better for this situation. As long as you loop through checking until %%string1 is not there, because in the sample HTML you posted there are 2 instances of the string to be deleted. You will also need to have a list or variable you can append as you step through.
moke |
|
| Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum You can attach files in this forum You can download files in this forum
|
|