====== SED - Align - Center all text in the middle of 79-column width ====== sed -e :a -e 's/^.\{1,77\}$/ & /;ta' # method 1 sed -e :a -e 's/^.\{1,77\}$/ &/;ta' -e 's/\( *\)\1/\1/' # method 2 **NOTE:** * In method 1, spaces at the beginning of the line are significant, and trailing spaces are appended at the end of the line. * In method 2, spaces at the beginning of the line are discarded in centering the line, and no trailing spaces appear at the end of lines.