24 lines
351 B
Sed
Executable File
24 lines
351 B
Sed
Executable File
#!/bin/sed -f
|
|
|
|
# Put 80 spaces in the buffer
|
|
1 {
|
|
x
|
|
s/^$/ /
|
|
s/^.*$/&&&&&&&&/
|
|
x
|
|
}
|
|
|
|
# del leading and trailing spaces
|
|
y/\t/ /
|
|
s/^ *//
|
|
s/ *$//
|
|
|
|
# add a newline and 80 spaces to end of line
|
|
G
|
|
|
|
# keep first 81 chars (80 + a newline)
|
|
s/^\(.\{81\}\).*$/\1/
|
|
|
|
# \2 matches half of the spaces, which are moved to the beginning
|
|
s/^\(.*\)\n\(.*\)\2/\2\1/
|