if [[ $1 == '' ]]
then
 echo 'needs a parameter: producer'
 exit
fi  


sed -rn "/ Full/{
s/(.{24}).{19}(.{17}).{15}(.+)/\1\2\3/
s/\.(ies|IES|ldt|LDT|eld|ELD)//p}" sli65-70.txt > sli.txt

sed -r "s/PRODUCER/$1/" ~/fixtures/all.head > fs.txt
cat ~/fixtures/sli.head >> fs.txt
cat sli.txt >> fs.txt

sed -r "s/PRODUCER/$1/" ~/fixtures/all_5.head > fs_5.htm
sed  -r '
s|.+ ([a-zA-Z0-9_+.-]+) *$|<A href=\"htm/\1.htm\"><img SRC=\"small/\1.png\">|
' sli.txt >> fs_5.htm

sed -r "s/PRODUCER/$1/" ~/fixtures/all_single.head > fs_single.htm
sed  -r '
s|.+ ([a-zA-Z0-9_+.-]+) *$|<A href=\"htm/\1.htm\"><img SRC=\"small_single/\1.png\">|
' sli.txt >> fs_single.htm		 

sed -r "s/PRODUCER/$1/" ~/fixtures/README.fs.head > README.html

# now with no heading
cat sli.txt | sort -k 6 -r -n > fs70.txt
sed -r "s/PRODUCER/$1/" ~/fixtures/all_5_70.head > fs_5_70.htm
sed  -r '
s|.+ ([a-zA-Z0-9_+.-]+) *$|<A href=\"htm/\1.htm\"><img SRC=\"small/\1.png\">|
' fs70.txt >> fs_5_70.htm		 

# and with the heading
sed -r "s/PRODUCER/$1/" ~/fixtures/sli70.head > fs70.txt
cat ~/fixtures/sli.head >> fs70.txt
cat sli.txt | sort -k 6 -r -n >> fs70.txt

sed -r "s/PRODUCER/$1/" ~/fixtures/sli65.head > fs65.txt
cat ~/fixtures/sli.head >> fs65.txt
cat sli.txt | sort -k 5 -r -n >> fs65.txt

sed -r "s/PRODUCER/$1/" ~/fixtures/sli_max.head > fs_max.txt
cat ~/fixtures/sli.head >> fs_max.txt
cat sli.txt | sort -k 7 -r -n >> fs_max.txt

rm sli.txt

#zip -r all_FS large large_single small small_single htm sli70* sli65* \
# sli_max* all*.txt all*.htm fs* README.html

#zip -r all.zip fs* README.html
