Mercurial > hg > cc > cirrus_home
comparison bin/ix.sh @ 91:82c94684f799
working with one input
author | Henry S. Thompson <ht@inf.ed.ac.uk> |
---|---|
date | Wed, 14 Apr 2021 10:08:41 +0000 |
parents | 5384208a0834 |
children | d56465d5c51f |
comparison
equal
deleted
inserted
replaced
90:5384208a0834 | 91:82c94684f799 |
---|---|
36 iflag=skip_bytes,count_bytes 2>/dev/null | 36 iflag=skip_bytes,count_bytes 2>/dev/null |
37 done | unpigz -dp 1 -c | \ | 37 done | unpigz -dp 1 -c | \ |
38 { s="w" | 38 { s="w" |
39 if [ -n "$p" ] | 39 if [ -n "$p" ] |
40 then | 40 then |
41 shopt -qs extglob # for %%*(...) | |
41 while read -r L | 42 while read -r L |
42 do | 43 do |
43 if [ "$s" = "w" ] | 44 if [ "$s" = "w" ] |
44 then | 45 then |
45 # WARC header | 46 # WARC header |
46 if [ "$L" = " | 47 if [ "$L" = " |
47 " ] | 48 " ] |
48 then | 49 then |
49 s="h" | 50 s="h" |
51 if [[ -n "$w" && ( -n "$h" || -n "$b" ) ]] | |
52 then | |
53 echo | |
54 fi | |
50 continue | 55 continue |
51 fi | 56 fi |
52 if [ -n "$w" ] | 57 if [ -n "$w" ] |
53 then | 58 then |
54 printf "%s\n" "${L%% | 59 printf "%s\n" "${L%% |
59 if [ "$s" = "h" ] | 64 if [ "$s" = "h" ] |
60 then | 65 then |
61 # HTTP header | 66 # HTTP header |
62 case "$L" in | 67 case "$L" in |
63 | 68 |
64 ) s="b" ; n=0 ; continue ;; | 69 ) s="b" ; n=0 |
70 if [ -n "$h" -a -n "$b" ] | |
71 then | |
72 echo | |
73 fi | |
74 continue ;; | |
65 Content-Length:\ *) bl=${L##*: } | 75 Content-Length:\ *) bl=${L##*: } |
66 bl=${bl%%*([ | 76 bl=${bl%%*([ |
67 [:space:]])} | 77 [:space:]])} |
68 ;; | 78 ;; |
69 esac | 79 esac |
75 continue | 85 continue |
76 else | 86 else |
77 # HTTP body | 87 # HTTP body |
78 if [ -n "$b" ] | 88 if [ -n "$b" ] |
79 then | 89 then |
80 printf "%s\n" "$bl" 1>&2 | 90 #printf "%s\n" "$bl" 1>&2 |
81 head -c "$bl" | 91 head -c "$bl" |
82 else | 92 else |
83 break | 93 break |
84 fi | 94 fi |
85 fi | 95 fi |