#!/bin/bash
# break the combined .vcf $1 into individual .vcf files in current directory
inline="BOF"	# Beginning of File
let lastfile=-1
let filename=0
let linenum=1				# from Beginning of File
while [ $filename \!= $lastfile ] ; do	# yes we found something to process
	let lastfile=$filename			# presume not the next cycle
echo ======= $lastfile =======
	until [ "      1       0       2" == "`echo $inline | wc`" ] ; do		# have non null input
		$(tail -n +"$linenum" "$1" | head -n 1 >> "$filename".vcf)
		inline="$(tail -n +$linenum $1 | head -n 1)"
echo $inline
		let linenum=1+$linenum
	done \
	&& $(let filename=1+$lastfile ; inline="BOF") \
	|| exit -1
done


syntax highlighted by Code2HTML, v. 0.9.1