Re: http site text-only read possible?



David Frank wrote:
> "Dr Ivan D. Reid" <Ivan.Reid@xxxxxxxxxxxx> wrote in message
> news:slrnda8rnr.27s.Ivan.Reid@xxxxxxxxxxxxxxxxxxxx
>
> > If you switch off image display then the image files aren't fetched
> > until you request them -- at least that's how it used to work when I was
> > on
> > slow connexions.
> >
>
> Here is a typical link that I try to decode in my RT_VIEW program.
>
> http://www.finance.lycos.com/qc/stocks/quotes.aspx?symbols=INDEX:SPX.X
>
>
> Read of this web page fills my RT_VIEW program's net read buffer with about
> 16kb of superfluous html that I then must parse to get my price data.

from the link supplied in a previous posting obtain wget.exe

set up a scheduled task which runs a .bat file containing

wget -O foo.txt url_goes_here
awk -f foo.awk foo.txt | awk -f foo1.awk >foo1.txt
my_fortran_program.exe .....

Notes:

The -O switch sends the downloaded file to the file "foo.txt"

foo.awk and foo1.awk are AWK scripts

The pattern in foo.awk matches all lines from a line containing the
first pattern to a line containing the second pattern. This is the HTML
table containing the data of interest.

foo1.awk grabs lines containing table data, removes extra stuff and
then concatenates the 8 numeric values into a single line of blank
separated data.

Finally a Fortran program reads and does something with the data
file....

foo.awk:

/<table summary=/,/<\/table>/

foo1.awk:

# grab <td>.....</td>
/<td>.*<\/td>$/ {
gsub(/ - /," ") # strip -
gsub(/,/,"") # strip ,
gsub(/ to /," ") # strip to
gsub(/\//,"") # strip /
gsub(/<td>/,"") # strip <td>
for(i=1;i<=NF;i++) b=b " " $i # append next number
# print # for debug
}
END{print b} # dump the vector

The OP or NG regulars are welcome to replace the AWK scripts with
Fortran programs, etc. if they so choose :-)!

A sample foo1.txt:

1192.75 1197.43 1196.02 1196.02 667 1375 1060.72 1229.11

Disclaimer: I take _no_ responsibility if the OP gets into trouble for
repeatedly and frequently wgetting this web page. :-).

.



Relevant Pages

  • Re: Why dont variables work in switch patterns?
    ... | substitutions on the pieces. ... switch -- $value { ... does NOT substitute in either the pattern or bodies, ... As soon as it finds a pattern that matches string it evaluates the following body argument by passing it recursively to the Tcl interpreter and returns the result of that evaluation. ...
    (comp.lang.tcl)
  • Re: Comparing memory with a constant
    ... switch (array) { ... case bitpattern1: ... ... matched pattern #0 ... ... for computing a number to switch on, ...
    (comp.lang.c)
  • Re: Advice on landing better
    ... and did two passes in the pattern. ... It is as if the hand just reaches out on its own and hits the switch. ... All you probably really need is practice, perhaps with some supervision so that your instructor can tell you exactly what you need to improve and so you don't practice bad habits. ... World Famous Flight Instructor ...
    (rec.aviation.student)
  • Re: Your juggling weaknesses.
    ... Mark Nicoll wrote: ... barrier that causes me to just switch off around 250 catches in any ... pattern with any number of balls. ... I start a stopwatch, then count five ...
    (rec.juggling)
  • Re: http site text-only read possible?
    ... > If you switch off image display then the image files aren't fetched ... > until you request them -- at least that's how it used to work when I was ...
    (comp.lang.fortran)