sorting-a-range-of-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 input file: winston.txt, selects the records from the third
   3    paragraph and sorts them. The two ELASTIC stages ensure that the pipeline does not stall and
   4    that records from other paragraphs are buffered and then fed back to the first pipeline 
   5    in the correct order. */
   6
   7 Address Rxpipe
   8
   9 'pipe (endchar ?)',
  10      '< &installdrive:\&installpath\examples\input\winston.txt', /* Read the input file. */
  11      '| a: drop 8',                       /* Select only records.. */
  12      '| b: take 5',                       /* ..9 through 13. */
  13      '| sort anycase',                    /* Sort the records. */
  14      '| specs recno strip 1.2 1-* nw',    /* Insert leading record number. */
  15      '| c: fanin 1 0 2',                  /* Read streams in paragraph output order. */
  16      '| cons',                            /* Display on the console. */
  17      '?',
  18      'a:',                                /* Unselected records 1 to 11. */
  19      '| elastic',                         /* Buffer as necessary. */
  20      '| c:',                              /* Back to main pipeline. */
  21      '?',
  22      'b:',                                /* Unselected records 17 to e-o-f. */
  23      '| elastic',                         /* Buffer as necessary. */
  24      '| c:'                               /* Back to main pipeline. */
  25
  26 Say 'Hit Enter to close..'
  27 Parse Pull
  28
  29 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 the clocks were striking thirteen.

   5 Winston Smith, his chin nuzzled into his breast in an effort to escape the vile

   6 wind, slipped quickly through the glass doors of Victory Mansions, though not

   7 quickly enough to prevent a swirl of gritty dust from entering along with him.

   8

   9 1  about forty-five, with a heavy black moustache and ruggedly handsome features.

  10 2  coloured poster, too large for indoor display, has been tacked to the wall. It

  11 3  depicted simply an enormous face, more than a metre wide: the face of a man

  12 4  The hallway smelt of boiled cabbage and old rag mats. At one end of it a

  13 5  Winston made for the stairs.

  14

  15 It was no use trying the lift. Even at the best of times it was seldom working,

  16 and at present the electric current was cut off during daylight hours. It was

  17 part of the economy drive in preparation for Hate Week. The flat was seven

  18 flights up, and Winston, who was thirty-nine and had a varicose ulcer above his

  19 right ankle, went slowly, resting several times on the way. On each landing,

  20 opposite the lift shaft, the poster with the enormous face gazed from the wall.

  21 It was one of those pictures which are so contrived that the eyes follow you

  22 about when you move.

  23

  24 BIG BROTHER IS WATCHING YOU, the caption beneath it ran.

  25

  26

  27

  28

  29 Hit Enter to close..