split-before-target.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 splits each record before each
   3    occurrence of the word 'the'. */
   4
   5 Address Rxpipe
   6
   7 'pipe < &installdrive:\&installpath\examples\input\winston.txt',
   8      '| split before string /the/',           /* Split before 'the'. */
   9      '| cons'                                 /* Display on the console. */
  10
  11 Say 'Hit Enter to close..'
  12 Parse Pull
  13
  14 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 day in April, and
   5 the clocks were striking thirteen.
   6 Winston Smith, his chin nuzzled into his breast in an effort to escape
   7 the vile
   8 wind, slipped quickly through
   9 the glass doors of Victory Mansions, though not
  10 quickly enough to prevent a swirl of gritty dust from entering along with him.
  11
  12 The hallway smelt of boiled cabbage and old rag mats. At one end of it a
  13 coloured poster, too large for indoor display, has been tacked to
  14 the wall. It
  15 depicted simply an enormous face, more than a metre wide:
  16 the face of a man
  17 about forty-five, with a heavy black moustache and ruggedly handsome features.
  18 Winston made for
  19 the stairs.
  20
  21 It was no use trying
  22 the lift. Even at
  23 the best of times it was seldom working,
  24 and at present
  25 the electric current was cut off during daylight hours. It was
  26 part of
  27 the economy drive in preparation for Hate Week. The flat was seven
  28 flights up, and Winston, who was thirty-nine and had a varicose ulcer above his
  29 right ankle, went slowly, resting several times on
  30 the way. On each landing,
  31 opposite
  32 the lift shaft,
  33 the poster with
  34 the enormous face gazed from
  35 the wall.
  36 It was one of those pictures which are so contrived that
  37 the eyes follow you
  38 about when you move.
  39
  40 BIG BROTHER IS WATCHING YOU,
  41 the caption beneath it ran.
  42
  43
  44
  45
  46 Hit Enter to close..