Mercurial > hg > cc > cirrus_home
view bin/clm.sh @ 164:00b14a35280e
work-path bin dir
author | Henry S. Thompson <ht@inf.ed.ac.uk> |
---|---|
date | Mon, 18 Jul 2022 18:30:56 +0100 |
parents | d3ef00af2064 |
children |
line wrap: on
line source
#!/usr/bin/bash if [ $# -ne 1 ] then echo "Usage: clm.sh outfile Reads from stdin, which should be a complete set of HTTP header lines, and _appends_ either the value of the Last-Modified header or a blank line to the specified output file. In case of a set of headers containing more than one Last-Modified line, that output still consists of a single line, with all the values, separated by a semi-colon (;). So the output always consists of exactly one line." exit 1 fi egrep '^Last-Modified: ' | cut -f 2- -d ' ' | tr -d '\r' | { readarray -t a ; IFS=';' ; printf %s "${a[*]}" ; } >> "$1" echo >> "$1"