#!/bin/bash # Usage: wpull2-extract-remaining [FILENAME] # FILENAME points to a wpull 2.x SQLite DB; if not specified, defaults to wpull.db # Prints all remaining URLs from the DB on stdout if [[ $# -eq 1 ]] then filename="$1" else filename=wpull.db fi if [[ ! -f "${filename}" ]] then echo "Error: ${filename} does not exist or is not a regular file" >&2 exit 1 fi for status in in_progress todo error do sqlite3 "${filename}" 'SELECT url_strings.url FROM queued_urls JOIN url_strings ON url_string_id = url_strings.id WHERE status = "'$status'"' done