- or download this
#!/usr/local/bin/perl -ln0777
...
print " " x (40 - ($c = 1 + length $1) / 2), $1
}
- or download this
a
a a a
...
words only on spaces or new lines
- or download this
> perl -ln0777we '$c=0;s/\s+/ /sg;print" "x(40-($c=length$1)/2),$1 whi
+le s/(.{$c,}?. |.+$)//' a.txt w.txt
a
a a
...
lines
- or download this
> perl -ln0777e's/\s+/ /sg;print$"x(40-($c=length$&)/2),$&while s/.{0$
+c,}?. |.+$//' a.txt w.txt
a
a a
...
a a a a a a a a
a a a a a