Convert unwrapped paragraphs to hard wrapped paragraphs when there's no blank lines.

Linux for blind general discussion blinux-list at
Fri Mar 27 19:27:02 UTC 2020

On March 27, 2020, Linux for blind general discussion wrote:
> does anyone know a way to automate inserting blank lines before
> and after each line in a file that's too long to fit on the screen
> all at once and then hard wrap those long lines?

Well, since adding a blank line after each line-break puts a blank
line before the next line, you (should?) only need to add newlines
after each line which can easily be done with sed:

  $ sed G input_file.txt > output_file_with_spaces.txt

If you want to format the lines at the same time, you can do that
with "fmt"

  $ sed G input.txt | fmt > formatted_output_with_spaces.txt

By default, fmt formats to 72 characters wide but you can adjust that

  fmt -80

Hope this helps,


More information about the Blinux-list mailing list