Mercurial > hg > cc > cirrus_home
annotate bin/clm.sh @ 140:0a447db5cf1c
move to ec164.guest
author | Henry S. Thompson <ht@inf.ed.ac.uk> |
---|---|
date | Tue, 19 Oct 2021 12:55:30 +0000 |
parents | d3ef00af2064 |
children |
rev | line source |
---|---|
125
cd927e5c133f
extract Last Modified via cdx
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
diff
changeset
|
1 #!/usr/bin/bash |
134 | 2 if [ $# -ne 1 ] |
3 then | |
4 echo "Usage: clm.sh outfile | |
5 Reads from stdin, which should be a complete set of HTTP header lines, | |
6 and _appends_ either the value of the Last-Modified header or a blank | |
7 line to the specified output file. | |
8 | |
9 In case of a set of headers containing more than one Last-Modified line, | |
10 that output still consists of a single line, with all the values, | |
11 separated by a semi-colon (;). | |
12 | |
13 So the output always consists of exactly one line." | |
14 exit 1 | |
15 fi | |
131 | 16 egrep '^Last-Modified: ' | cut -f 2- -d ' ' | tr -d '\r' | { readarray -t a ; IFS=';' ; printf %s "${a[*]}" ; } >> "$1" |
130
5efc3985d513
handle multiple L-M lines :-(
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
125
diff
changeset
|
17 echo >> "$1" |
125
cd927e5c133f
extract Last Modified via cdx
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
diff
changeset
|
18 |