[dev] ssam rocks! unwrapping paragraphs

From: Greg Reagle <list_AT_speedpost.net>
Date: Tue, 22 Mar 2022 15:56:25 -0400

Hello. I downloaded a text file from Project Gutenberg and the paragraphs were hard wrapped, aka filled in Emacs jargon. I want the lines to wrap to whatever window width I am using of course, so I want them to be un-wrapped in the text file. I tried all sorts of sed/awk/grep/perl ways to unwrap the paragraphs (that were complicated), but nothing worked well. Then I did:

ssam -e 'x/\n+/ v/\n\n+/ c/ /'

Bingo! So elegant, so effective. Would you consider adding ssam to 9base? It is a simple script in the Plan9Port project.

I challenge you, if you are interested, to come up with another way of unwrapping the paragraphs that sucks less than the ssam command above.
Received on Tue Mar 22 2022 - 20:56:25 CET

This archive was generated by hypermail 2.3.0 : Tue Mar 22 2022 - 21:00:08 CET