#!/bin/sh
FILE1="$1"
FILE2="$2"
BEGIN="$3"
END="$4"

# Substitute the region between BEGIN and END in FILE1 into FILE2

cat "${FILE2}" | sed  -e "1,/${BEGIN}/!d" -e "/${BEGIN}/d" > tmpx
cat "${FILE1}" | sed -e "/${BEGIN}/,/${END}/!d"  >> tmpx
cat "${FILE2}" | sed -e "/${END}/,500000!d" -e "/${END}/d" >> tmpx


