Skip to content

Instantly share code, notes, and snippets.

@mnp
Created August 16, 2014 19:56
Show Gist options
  • Select an option

  • Save mnp/c563c319119b7b040df8 to your computer and use it in GitHub Desktop.

Select an option

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
#!/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