#!/usr/bin/sed -f # center all lines of a file, on a 80 columns width # # to change that width, the 2nd number in \{\} must be replaced to w-1 # del leading and trailing spaces y/ / / s/^ *// s/ *$// :x /^.\{1,78\}$/ { s/^.*$/ & /; bx; } # Remove trailing spaces s/ *$//