split-using-specs.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: Flann.txt and cuts each input record into
   3    three output records.
   4    The first output record comprises the contents of columns 1 to 10 of the input record, the
   5    second, are columns 11 to 20, and the third, are columns 21 up to and including the last
   6    column of the input record.
   7    
   8    This example is intended to demonstrate how you can produce multiple output records from
   9    a single input record. */
  10
  11 Address Rxpipe
  12
  13 'pipe (endchar ?)',
  14      '< &installdrive:\&installpath\examples\input\flann.txt',
  15      '| take first 10',        /* Select only the first 10 records. */
  16      '| strip trailing',       /* Trim off whitespace. */
  17      '| a: locate',            /* Send null records to second pipeline. */
  18      '| specs 1.10 1 write',   /* Write record comprising cols 1-10. */
  19              '11.10 1 write',  /* Write record comprising cols 11-20. */
  20              '21-* 1',         /* Write record comprising cols 21 to end-of-record. */
  21      '| b: faninany',          /* Read from any stream. Preserve order of blank records. */
  22      '| console',              /* Display on the console. */
  23      '?',
  24      'a:',
  25      '| take *',               /* accept null records and route.. */
  26      '| b:'                    /* ..back to FANINANY. */
  27
  28 Say 'Hit Enter to close..'
  29 Parse Pull
  30
  31 Exit 0
     **** End of file ****
 

Console output

 
.....|...+....1....+....2....+....3....+....4....+....5....+....6....+....7....+....8....+....9....+....10...
   1 THE LONG a
   2 nd unprece
   3 dented conversation I had with Policeman MacCruiskeen after I
   4 went in to
   5  him on my
   6  mission with the cigarette brought to my mind afterwards several
   7 of the mor
   8 e delicate
   9  speculations of de Selby, notably his investigation of the nature
  10 of time an
  11 d eternity
  12  by a system of mirrors. His theory as I understand it is
  13 as follows
  14 ;
  15
  16
  17 If a man s
  18 tands befo
  19 re a mirror and sees in it his reflection, what he sees is not a
  20 true repro
  21 duction of
  22  himself but a picture of himself when he was a younger man.
  23 de Selby's
  24  explanati
  25 on of this phenomenon is quite simple. Light, as he points out
  26 truly enou
  27 gh, has an
  28  ascertained and finite rate of travel. Hence before the reflection
  29 Hit Enter to close..