On Wed, 27 Oct 2010, Raymond Norton wrote:
> The file does not exist yet ( I will use the existing file for testing),
> but I imagine the headings will appear like this:
>
> COUNCIL MEMBER SEAT 1 CITY OF HUTCHINSON
>
> and
>
> COUNTY SHERIFF
>
> The refresh can be taken care of with the following:
>
> <meta http-equiv="refresh" content="5" >
The attached bash script, as currently written, grabs the HTML file,
filters it through a perl regexp search/replace filter and produces the
following output. See instructions on how to fix it for your particular
job. We don't know exactly the format of the file right now, so I give a
couple of guesses. The input uses Windows text (carriage-return, newline
pairs at ends of lines, so the script retains that).
<html>
<meta http-equiv="refresh" content="5" >
<PRE>
PRECINCT REPORT MCLEOD COUNTY, MINNESOTA UNOFFICIAL RESULTS
RUN DATE:11/06/08 GENERAL ELECTION
RUN TIME:12:06 PM NOVEMBER 4, 2008
COUNCIL MEMBER SEAT 3 CITY OF HUTCHINSON
VOTE FOR UP TO 1
ERIC YOST . . . . . . . . . . . 1311 50.68
MARY CHRISTENSEN . . . . . . . . . 1270 49.09
WRITE-IN. . . . . . . . . . . . 6 .23
JUDGE 28 1ST DISTRICT COURT
VOTE FOR UP TO 1
KAREN ASPHAUG . . . . . . . . . . 1841 99.46
WRITE-IN. . . . . . . . . . . . 10 .54
</pre>
</html>
Best,
Mike
-------------- next part --------------
#!/bin/bash
wget -qO - http://www.co.mcleod.mn.us/department_files/Auditor/Election_results/general/EL30.htm | \
# comment out this line:
perl -pe 'BEGIN{undef $/} ; s#.*?<HTML>(.*?)(\r\n){2}.*\n( *COUNCIL MEMBER SEAT 3 CITY OF HUTCHINSON.*?(\r\n){2}).*?\n( *JUDGE 28.*?(\r\n){2}).*#<html>\r\n<meta http-equiv="refresh" content="5" >\r\n$1$2$2$3$5</pre>\r\n</html>\r\n#s' > EL30_part.html
# uncomment this line if SHERIFF comes second:
# perl -pe 'BEGIN{undef $/} ; s#.*?<HTML>(.*?)(\r\n){2}.*\n( *COUNCIL MEMBER SEAT 1 CITY OF HUTCHINSON.*?(\r\n){2}).*?\n( *COUNTY SHERIFF.*?(\r\n){2}).*#<html>\r\n<meta http-equiv="refresh" content="5" >\r\n$1$2$2$3$5</pre>\r\n</html>\r\n#s' > EL30_part.html
# uncomment this line if SHERIFF comes first:
# perl -pe 'BEGIN{undef $/} ; s#.*?<HTML>(.*?)(\r\n){2}.*\n( *COUNTY SHERIFF.*?(\r\n){2}).*?\n( *COUNCIL MEMBER SEAT 1 CITY OF HUTCHINSON.*?(\r\n){2}).*#<html>\r\n<meta http-equiv="refresh" content="5" >\r\n$1$2$2$3$5</pre>\r\n</html>\r\n#s' > EL30_part.html