This reads the lines in an array and if the first words on each line are not identical a blank line in inserted otherwise the lines are tight:
local prev="${(M)final[1]#*$' '}"
local final2=()
for ((ii=1; ii<=$#final; ii++)); do
ffile="${(M)final[ii]#*$' '}"
if [[ "$prev" == "$ffile" ]]; then
final2+=$final[ii]
else
final2+=" "
prev=$ffile
fi
done
... it works but I don't understand why. >final2+=" "< creates a newline, which is what I want but it would seem to only append a space, not a newline. Perhaps since final2 is an array, zsh cleverly presumes that any '+=' must mean 'append to next element'? I figger so but I'd better ask. IOW, if I wanted to append a space to the end of the last element, I'd have to be explicit about that, yes? It seems reasonable.