heredocs require a blank space, but sed '/^$/d' unconditionally removes them when generating
sed '/^$/d'