adding-a-header-record.rex |
Pipelines v2.1 |
.....|...+....1....+....2....+....3....+....4....+....5....+....6....+....7....+....8....+....9....+....10... |
**** Top of file ****
1
2 /* The following pipeline reads the input file: winston.txt, and formats each paragraph so that,
3 without splitting words, each record is no longer than 60 characters. After every twelve records
4 a rule is inserted into the output. */
5
6 Address Rxpipe
7
8 'pipe (endchar ? stagesep ~)',
9 '< &installdrive:\&installpath\examples\input\winston.txt',
10 ,
11 /* Call the Maxlength pipeline to format each paragraph to a maximum record length of 60. */,
12 '~ call "&installdrive:\&installpath\examples\subroutine\max-length" 60',
13 ,
14 '~ a: progress 12', /* Rule every 12 records */
15 '~ b: faninany', /* Merge data and rule records. */
16 '~ cons', /* Display on the console. */
17 '?',
18 'a:',
19 '~ literal /trigger/', /* The trigger. */
20 ,
21 /* Header record. */,
22 '~ specs',
23 '/ 1 2 3 4 5 6 7 8 9/ 1',
24 'x0a n',
25 '/123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890/ n',
26 'x0a n',
27 '/|--------+---------+---------+---------+---------+---------+---------+---------+---------|/ n',
28 '~ b:'
29
30 Say 'Hit Enter to close..'
31 Parse Pull
32
33 Exit 0
**** End of file ****
Console
output |
.....|...+....1....+....2....+....3....+....4....+....5....+....6....+....7....+....8....+....9....+....10...
1 1 2 3 4 5 6 7 8 9
2 123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890
3 |--------+---------+---------+---------+---------+---------+---------+---------+---------|
4
5
6
7 It was a bright cold day in April, and the clocks were
8 striking thirteen. Winston Smith, his chin nuzzled into his
9 breast in an effort to escape the vile wind, slipped quickly
10 through the glass doors of Victory Mansions, though not
11 quickly enough to prevent a swirl of gritty dust from
12 entering along with him.
13
14 The hallway smelt of boiled cabbage and old rag mats. At one
15 end of it a coloured poster, too large for indoor display,
16 1 2 3 4 5 6 7 8 9
17 123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890
18 |--------+---------+---------+---------+---------+---------+---------+---------+---------|
19 has been tacked to the wall. It depicted simply an enormous
20 face, more than a metre wide: the face of a man about
21 forty-five, with a heavy black moustache and ruggedly
22 handsome features. Winston made for the stairs.
23
24 It was no use trying the lift. Even at the best of times it
25 was seldom working, and at present the electric current was
26 cut off during daylight hours. It was part of the economy
27 drive in preparation for Hate Week. The flat was seven
28 flights up, and Winston, who was thirty-nine and had a
29 varicose ulcer above his right ankle, went slowly, resting
30 several times on the way. On each landing, opposite the lift
31 1 2 3 4 5 6 7 8 9
32 123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890
33 |--------+---------+---------+---------+---------+---------+---------+---------+---------|
34 shaft, the poster with the enormous face gazed from the
35 wall. It was one of those pictures which are so contrived
36 that the eyes follow you about when you move.
37
38 BIG BROTHER IS WATCHING YOU, the caption beneath it ran.
39
40
41
42
43 Hit Enter to close..
|