#	usage:	merge src1 src2 [ dest ]
#	merge two files, every other line.
#	the first argument starts off the merge,
#	excess lines of the longer file are appended to
#	the end of the resultant file
exec 4<$1 5<$2
dest=${3-$1.m}		# default destination file is named $1.m
while true 
do
			# alternate reading from the files;
			# 'more' represents the file descriptor
			# of the longer file
	line <&4 >>$dest || { more=5; break ;}
	line <&5 >>$dest || { more=4; break ;}
done
ed - $dest <<\eof
	H		# delete the last line of destination
	$d		# file, because it is blank.
	w
	q
eof
while line <&$more >> $dest
do :; done		# read the remainder of the longer
			# file - the body of the 'while' loop
			# does nothing; the work of the loop
			# is done in the command list following
			# 'while'
