annotate bin/ix.sh @ 88:464d2dfb99c9

new
author Henry S. Thompson <ht@inf.ed.ac.uk>
date Tue, 13 Apr 2021 17:02:09 +0000
parents
children 90f8f28b2e51
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
88
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
diff changeset
1 #!/usr/bin/bash
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
diff changeset
2 # Extract records from warc files given filename, length and offset triples
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
diff changeset
3 # from stdin or as command line args
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
diff changeset
4 if [ -n "$1" ]
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
diff changeset
5 then
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
diff changeset
6 printf "%s\t%s\t%s\n" "$1" "$2" "$3"
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
diff changeset
7 else
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
diff changeset
8 cat
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
diff changeset
9 fi | \
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
diff changeset
10 while { IFS=$'\t' read f l o; }
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
diff changeset
11 do
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
diff changeset
12 dd if="$f" of=/dev/stdout skip=$o count=$l iflag=skip_bytes,count_bytes
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
diff changeset
13 done | unpigz -dp 1 -c