sed:align:center_all_text_in_the_middle_of_79-column_width

This is an old revision of the document!


SED - Align - Center all text in the middle of 79-column width

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.

sed  -e :a -e 's/^.\{1,77\}$/ & /;ta'                     # method 1
sed  -e :a -e 's/^.\{1,77\}$/ &/;ta' -e 's/\( *\)\1/\1/'  # method 2
sed/align/center_all_text_in_the_middle_of_79-column_width.1597578693.txt.gz · Last modified: 2020/08/16 11:51 by 192.168.1.1

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki