locate-and-mark.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 and prefixes each record that contains
   3    the literal "winston" with a "-->" followed by the record number. At the end of the output a summary
   4    of the records that have been marked is displayed. */
   5
   6 Address Rxpipe
   7
   8 'pipe (endchar ? stagesep |)',
   9      '< &installdrive:\&installpath\examples\input\winston.txt', /* Read input file. */
  10      '| specs recno 1 1-* nw',                                   /* Insert leading record number. */
  11      '| a: locate anycase string /winston/',                     /* None-case-sensitive find of.. */
  12         ,                                                        /* ..the word "winston". */
  13      '| specs /-->/ 1 1-* 5',                                    /* Mark the record. */
  14      '| d: fanout',                                              /* Route to summary pipeline. */
  15      '| b: faninany',                                            /* Read any input stream. */
  16      '| c: fanin 1 *',                                           /* Read from stream 1 then 0. */
  17      '| cons',                                                   /* Display on the console. */
  18      '?',
  19      'a:',
  20      '| specs 1-* 5',                                            /* Position record at col 5. */
  21      '| b:',                                                     /* Route record back to Faninany. */
  22      '?',
  23      'literal /Mark records containing the word: "winston", with: "-->"/', /* Header. */
  24      '| specs x0a 1 1-* n x0a n',                                /* Surround with blank records. */
  25      '| c:',                                                     /* Route record back to Fanin. */
  26      '?',
  27      'd:',
  28      '| specs w2 1',                                             /* Isolate the record number. */
  29      '| join * /,/',                                             /* Delimit with a comma. */
  30      '| specs x0a 1 /Records marked: / n 1-* n',                 /* Add the description. */
  31      '| specs 1-* 1 x0a n',                                      /* Add carriage return. */
  32      '| cons'                                                    /* Display on the console. */
  33
  34 Say 'Hit Enter to close..'
  35 Parse Pull
  36
  37 Exit 0
     **** End of file ****