Created
August 16, 2014 19:56
-
-
Save mnp/c563c319119b7b040df8 to your computer and use it in GitHub Desktop.
Quick scraper: Wegman's shopping app web page -> print to PDF-> pdftotext -> this thing -> shopping list as CSV
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/perl | |
| print "##\n"; | |
| print "## Section, Price, Per, Description\n"; | |
| print "##\n"; | |
| while (<>) { | |
| chomp; | |
| s/\014//g; | |
| if(/(.*?\$.*?) - (.*)/) { | |
| printf "\"$category\", \"%s\",\"%s\",\"%s\"\n", $1, $2, $desc; | |
| } | |
| elsif ($desc and /^\d+/) { | |
| $category = $desc; | |
| } | |
| $desc = $_; | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment