counting-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 all the '.rex' files in the 'Examples' directory, accumulating the
   3    count of the total number of records. As each file is processed the name of the file is written
   4    to the console, followed at the end of processing with the count total. */
   5
   6 Address Rxpipe
   7
   8 'pipe (endchar ?)',
   9      'filelist noh',                                /* Generate file list. Don't write a header. */
  10               'drv=&installdrive',                  /* Drive with sub-search option. */
  11               'subdir',
  12               'path="&installpath\examples"',       /* Path to begin searching from. */
  13               'ext=rex',                            /* Extension type. */
  14      '| a: fanout',                                 /* Write record to both streams. */
  15      '| specs w5-* 1',                              /* Discard the file stats. */
  16      '| <',                                         /* Read each file. */
  17      '| count lines',                               /* Count the records. */
  18      '| specs /Total number of records:/ 1 1-* nw', /* Construct output message. */
  19      '| cons',                                      /* Tell the user. */
  20      '?',
  21      'a:',
  22      '| specs /Reading file:/ 1 ws /\/ w-1 nw',     /* Tell user about file currently.. */
  23         ,                                           /* ..being processed. */
  24      '| cons'                                       /* Tell the user. */
  25
  26 Say 'Hit Enter to close..'
  27 Parse Pull
  28
  29 Exit 0
     **** End of file ****