arranging-text-in-horizontal-columns.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; selects the first 8 words of
   3    each record and aligns them in columns 12 characters wide. */
   4
   5 Address Rxpipe
   6
   7 'pipe < &installdrive:\&installpath\examples\input\winston.txt',
   8      '| strip trailing',        /* Trim off whitespace. */
   9      '| locate',                /* Discard null records. */
  10      '| specs w1-8 1 /@/ nw',   /* Select words 1 - 8 and append the '@'. */
  11      '| split',                 /* Split into individual words. */
  12      '| specs 1-* 1.12',        /* Make the record twelve bytes long. */
  13      '| join until 1 str /@/',  /* Join records back together. */
  14      '| cons'                   /* Display on the console. */
  15
  16 Say 'Hit Enter to close..'
  17 Parse Pull
  18
  19 Exit 0
    **** End of file ****
 

Console output

 
.....|...+....1....+....2....+....3....+....4....+....5....+....6....+....7....+....8....+....9....+....10...
   1 It          was         a           bright      cold        day         in          April,
   2 Winston     Smith,      his         chin        nuzzled     into        his         breast
   3 wind,       slipped     quickly     through     the         glass       doors       of
   4 quickly     enough      to          prevent     a           swirl       of          gritty
   5 The         hallway     smelt       of          boiled      cabbage     and         old
   6 coloured    poster,     too         large       for         indoor      display,    has
   7 depicted    simply      an          enormous    face,       more        than        a
   8 about       forty-five, with        a           heavy       black       moustache   and
   9 Winston     made        for         the         stairs.
  10 It          was         no          use         trying      the         lift.       Even
  11 and         at          present     the         electric    current     was         cut
  12 part        of          the         economy     drive       in          preparation for
  13 flights     up,         and         Winston,    who         was         thirty-nine and
  14 right       ankle,      went        slowly,     resting     several     times       on
  15 opposite    the         lift        shaft,      the         poster      with        the
  16 It          was         one         of          those       pictures    which       are
  17 about       when        you         move.
  18 BIG         BROTHER     IS          WATCHING    YOU,        the         caption     beneath
  19 Hit Enter to close..