reading-a-file-backwards.rex

Pipelines v2.1

 

.....|...+....1....+....2....+....3....+....4....+....5....+....6....+....7....+....8....+....9....+....10...

Home

     **** Top of file ****
   1
   2 /* The following pipeline illustrates the most efficient way to select records that you know
   3    lie toward the end of a large input file. By reading the file in reverse record order; the
   4    target records can be located without unnecessarily traversing a significant portion of
   5    the file.
   6
   7    This approach may be of particular use when extracting data from large 'log-type' files. */
   8
   9 Address Rxpipe
  10
  11 'pipe < rev &installdrive:\&installpath\examples\input\nyse.txt',
  12      '| inside zone(w2) /134700/ /134200/', /* Select the block of records. */
  13      '| buffer rev',                        /* Reverse the records. */
  14      '| cons'                               /* Display the records on the console. */
  15
  16 Say 'Hit Enter to close..'
  17 Parse Pull
  18
  19 Exit 0
     **** End of file ****