in reply to Comment Block Creator

Goodness, I like perl. Here's the same thing in a fraction of the lines. It probably works.

use List::Util 'max'; use File::Copy 'copy'; use File::Slurp qw'read_file write_file'; @ARGV == 1 or die "$^X $0 filename.pl\n"; my $file = shift; copy $file, "$file.bak" or die "Couldn't copy $file to $file.bak: $!"; my $source = read_file( $file ); $source =~ s(^#/*.*\n((?s:.+?))^#*/.*\n){ my @lines = map /^\s*#\s*(.+?)[\s#]*$/, split /\n/, $1; my $len = 1 + max( map length(), @lines ); join "\n", "#" x $len, map( sprintf("%-" . ($len - 1) . "s #"), @lines ), "#" x $len }meg and write_file( $file, $source ) or die "Couldn't write changed source to $file: $!";