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