#!/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/^.*$/ & / b x } # Remove trailing spaces s/ *$// ### colorized by sedsed, a debugger and code formatter for sed scripts ### original script: http://sed.sf.net/grabbag/scripts/centre_2.sed