forked from adolfopa/miscutils
38 lines
424 B
Bash
Executable File
38 lines
424 B
Bash
Executable File
#!/bin/sh
|
|
expand |
|
|
sed -n '
|
|
/./!d
|
|
p
|
|
i\
|
|
|
|
:l
|
|
n
|
|
p
|
|
bl' |
|
|
sed -n '
|
|
:l
|
|
p
|
|
n
|
|
/./bl
|
|
:b
|
|
n
|
|
/./!bb
|
|
i\
|
|
|
|
bl' |
|
|
sed -e '1s/^/./' -e 's/^ /./' |
|
|
fmt -p |
|
|
awk '
|
|
BEGIN { LIMIT = 65 }
|
|
NR == 1 || /^[^\.]/ || length($0) < LIMIT {
|
|
sub(/^\./, NR == 1 ? "" : " ");
|
|
print;
|
|
}
|
|
/^\./ && length($0) >= LIMIT {
|
|
sub(/^\./, " ");
|
|
print substr($0, 1, LIMIT)"\\";
|
|
for (i = 2*LIMIT - length($0) + 1; i; i--)
|
|
printf " ";
|
|
print substr($0, LIMIT+1);
|
|
}'
|