Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/perl -w
- # accScrapeOnePage.pl
- local $/=undef;
- $data = <DATA>;
- # $data = <>;
- while ($data =~ /<h3 class="edims".*?(Item .*?)<\/h3>\s*<p class="edims">(.*?)<\/p>(.*)/s) {
- $refId = wrap ($1);
- $refDescr = wrap ($2);
- $data = $3;
- print $refId . "," . $refDescr . "\n";
- } # end while (<DATA>)
- #---------------------
- sub wrap {
- my $field = shift;
- # if the field contains a comma, it must be wrapped in double quotes
- if ($field =~ /,/s) {
- # since the field is being wrapped in quotes,
- # any existing quotes must be escaped with an extra quote
- # so, for any quotes that exist, replace with 2 quotes
- $field =~ s/"/""/g;
- # now, wrap field with quotes
- $field = '"' . $field . '"';
- } # end if ($field =~ /./s)
- return $field;
- } # end sub wrap
- __DATA__
- <!-- bla bla bla html stuff -->
- <p class="edims"> </p>
- <hr class="edims" /><a class="edims" name="002" id="002"></a>
- <h3 class="edims" style="color: #585858;">Item 2 - April 2, 2015</h3>
- <p class="edims">Authorize execution of an interlocal agreement with Caldwell County for the installation, maintenance, and repair of Caldwell County's wireless communications equipment for a 12-month term for an estimated amount not to exceed $5,000 payable to the City and with annual automatic renewal terms in the same estimated amount per renewal.</p>
- <p class="edims"> </p>
- <h4 class="edims"><b>Work Papers and Other Backup Documentation</b></h4>
- <!-- bla bla bla still more html stuff -->
- <h3 class="edims" style="color: #585858;">Item 3 - April 2, 2015</h3>
- <p class="edims">Authorize award and execution of a construction contract with SMITH CONTRACTING COMPANY, INC. for the 3rd Street Reconstruction Phase 4 Guadalupe Street to Nueces Street Project in the amount of $3,895,282.50 plus a $389,528.25 contingency, for a total contract amount not to exceed $4,284,810.75.</p>
- <p class="edims"> </p>
- ...
- <h3 class="edims" style="color: #585858;">Item 501 - April 2, 2015</h3>
- <p class="edims">Example with "quoted reference". Yet another contract, here. </p>
- <p class="edims"> </p>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement