#!/usr/bin/bash
# Usage wprog.sh seg start end=$(date) ty='warc' 
seg="$1"
shift
start="$1"
shift
end=$(date)
ty='warc'
while [ "$1" ]
do
 case "$1" in
  [A-Z]*)
    end="$1"
    shift
    ;;
   warc|robotstxt|crawldiagnostics)
    ty=$1
    shift
    ;;
   *)
    echo "Hunh?" "$@" 1>&2
    echo "Usage: wprog.sh start end=$(date) ty='warc'" 1>&2
    exit 1
    ;;
 esac
done
wprog.py $(fgrep -ch records x?/$seg/$ty/w* | btot -s | cut -f 2) "$start" "$end"
