#!/bin/bash
positions=`grep -n '^<HR>$' bed.html |cut -f 1 -d :`
declare -a pos
pos=($positions)
start=$[${pos[0]}+2]
end=${pos[1]}
len=$[$end-$start]
cat menustart > menu.html
tail +${start}l < bed.html |head -n ${len}|sed -e '{s/HREF=\"#/TARGET=\"text\" HREF=\"bed.1.html#/g;s/<DD>//g;s/<DL>/<DL COMPACT>/g;}'|sed -e 's/^\(.*\)bed.1.html[^"]*\(">*DOWNLOAD.*\)$/\1download.html\2/' >> menu.html
cat menuend >> menu.html
