inserting-words.rex

Pipelines v2.1

 

.....|...+....1....+....2....+....3....+....4....+....5....+....6....+....7....+....8....+....9....+....10...

Home

     **** Top of file ****
   1
   2 /* The following pipeline reads the file: winston.txt and inserts the text '123456789'
   3    in between words 5 and 6 of each record. */
   4
   5 Address Rxpipe
   6
   7 'pipe (endchar ?)',
   8      '< &installdrive:\&installpath\examples\input\winston.txt',
   9      '| strip trailing',                       /* Trim off whitespace. */
  10      '| a: locate',                            /* Bypass null records. */
  11      '| specs w1-5 1 /123456789/ nw w6-* nw',  /* Insert text between words 5 and 6. */
  12      '| b: faninany',                          /* Merge input streams. */
  13      '| console',                              /* Display on the console. */
  14      '?',
  15      'a:',
  16      '| take *',                               /* Read all records. */
  17      '| b:'                                    /* Route back null records. */
  18
  19 Say 'Hit Enter to close..'
  20 Parse Pull
  21
  22 Exit 0
     **** End of file ****
 

Console output

 
.....|...+....1....+....2....+....3....+....4....+....5....+....6....+....7....+....8....+....9....+....10...
   1
   2
   3
   4 It was a bright cold 123456789 day in April, and the clocks were striking thirteen.
   5 Winston Smith, his chin nuzzled 123456789 into his breast in an effort to escape the vile
   6 wind, slipped quickly through the 123456789 glass doors of Victory Mansions, though not
   7 quickly enough to prevent a 123456789 swirl of gritty dust from entering along with him.
   8
   9 The hallway smelt of boiled 123456789 cabbage and old rag mats. At one end of it a
  10 coloured poster, too large for 123456789 indoor display, has been tacked to the wall. It
  11 depicted simply an enormous face, 123456789 more than a metre wide: the face of a man
  12 about forty-five, with a heavy 123456789 black moustache and ruggedly handsome features.
  13 Winston made for the stairs. 123456789
  14
  15 It was no use trying 123456789 the lift. Even at the best of times it was seldom working,
  16 and at present the electric 123456789 current was cut off during daylight hours. It was
  17 part of the economy drive 123456789 in preparation for Hate Week. The flat was seven
  18 flights up, and Winston, who 123456789 was thirty-nine and had a varicose ulcer above his
  19 right ankle, went slowly, resting 123456789 several times on the way. On each landing,
  20 opposite the lift shaft, the 123456789 poster with the enormous face gazed from the wall.
  21 It was one of those 123456789 pictures which are so contrived that the eyes follow you
  22 about when you move. 123456789
  23
  24 BIG BROTHER IS WATCHING YOU, 123456789 the caption beneath it ran.
  25
  26
  27
  28
  29 Hit Enter to close..