|
max-length.rex |
Pipelines v2.1 |
.....|...+....1....+....2....+....3....+....4....+....5....+....6....+....7....+....8....+....9....+....10... |
**** Top of file **** 12 /* The following pipeline handles one input argument:
34 arg 1. The maximum output record length.
56 The pipeline reads its input and formats each paragraph so that, where possible, each
7 record is no longer than 'length' characters in length. If an input record comprises a single
8 word which is longer than 'length' characters in length, the record remains unchanged.
910 Note. leading, embedded and trailing whitespace is discarded during the process. */
1112 Address Rxpipe
1314 Parse Arg length
1516 'pipe (stagesep ~)',
17 'in', /* Read from input. */
18 '~ strip trailing', /* Trim off trailing whitespace, so we can find blank records. */
19 '~ split', /* Split into individual words. */
20 '~ join * x20' length , /* Join records up to a maximum length of 'length'. */
21 '~ out' /* Write to output. */
2223 Exit 0
**** End of file ****
|
|
Validate the arguments!