perl -ln0e's/\s+/ /g;print$"x(40-($c=length$&)/2),$&while/.{0$c,}? |.*/g' ...