# Centre text for an 80-column device. # Casper Boden-Cummins sed -n ' # remove leading and trailing blanks s/^[ ]*\(.*[^ ]\).*$/\1/ # append 80 spaces s/$/ / # chop character 80 onwards s/^\(.\{80\}\).*/\1/ # prefix string with half the trailing spaces s/^\(.*[^ ]\)\( *\)\(\2\)/\2\1/ p '