Sample Header Ad - 728x90

Use 'fold' to wrap lines at 72 column

0 votes
2 answers
129 views
Test file:
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmo tempor incididunt ut labore et dolore magna aliqua. Ut enim minim veniam quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
If using
script.sh input.txt output.txt
sed 's/ - /--/g
     s/ \{0,1\}[—–] \{0,1\}/--/g
     s/…/.../g
     s/\\\*/†/g
     s/*/\//g
     s/\\\././g' $1 |
fold -sw 72 |
sed 's/ *$//g' > $2
the output is ``` ------------------------------------------------------------------------ -s: Fold line after the last blank character within the first width column positions (or bytes). I use fold supplied with macOS, but if using GNU fold, the output file is the same.
Asked by jsx97 (1347 rep)
Aug 30, 2024, 06:24 PM
Last activity: Sep 3, 2024, 11:17 PM