Maxlength |
Pipelines v1.9 |
.* Example by TenFiftyTwo(c). |
.* The following pipeline handles one input argument:
.*
.* &arg1. The maximum output record length.
.* The pipeline reads its input and formats each paragraph so that, where possible, each
.* record is no longer than &arg1 characters in length. If an input record comprises a single
.* word which is longer than &arg1 characters in length, the record remains unchanged.
.* Note. leading, embedded and trailing whitespace is discarded during the process.
pipe (stagesep ~ comment //)
in // Read from input.
~ strip trailing // Trim off trailing whitespace, so we can find blank records.
~ split // Split into individual words.
~ join * x20 &arg1 // Join records up to a maximum length of &arg1.
~ out // Write to output.