# HG changeset patch # User Henry S. Thompson # Date 1626281394 0 # Node ID d3ef00af2064ba74c3348eabf8ba5bbbbb2c5f4f # Parent 660dc255542ae750e12815f7e781b70bf57127db add usage/help info diff -r 660dc255542a -r d3ef00af2064 bin/clm.sh --- a/bin/clm.sh Wed Jul 14 16:49:35 2021 +0000 +++ b/bin/clm.sh Wed Jul 14 16:49:54 2021 +0000 @@ -1,4 +1,18 @@ #!/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"