#!/usr/bin/bash
# Extract records from warc files given filename, length and offset triples
#  from stdin or as command line args
if [ -n "$1" ]
then
    printf "%s\t%s\t%s\n" "$1" "$2" "$3"
else
    cat
fi | \
while { IFS=$'\t' read f l o; }
do
  dd if="$f" of=/dev/stdout skip=$o count=$l iflag=skip_bytes,count_bytes
done | unpigz -dp 1 -c
