-
Notifications
You must be signed in to change notification settings - Fork 0
/
lcfold
executable file
·33 lines (30 loc) · 1.19 KB
/
lcfold
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
#! /bin/sed -Ef
# lcfold - fold lines using one space character for line continuation
# Copyright (C) 2018-2019 Erik Auerswald <[email protected]>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
# Fold (break) long lines by adding '\n ' as done e.g. in LDIF (RFC 2849),
# iCalendar (RFC 5545), or HTTP (RFC 2616). This script uses a hardcoded
# maximum line length of 72 characters.
#
# This script breaks a line after 72 characters, any subsequents breaks
# of the same input line occur after 71 characters because of the <space>
# character added to the output.
s/(.{72})(.)/\1\n \2/
t MORE
b END
: MORE
P
D
: END