removing-trailing-blank-records-1.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 and removes any trailing blank records.
   3    All the records are combined together to form a single record, trailing whitespace is then
   4    removed, finally, the combined record is split back into its constituent records. */
   5
   6 Address Rxpipe
   7
   8 'pipe < &installdrive:\&installpath\examples\input\winston.txt',
   9      '| strip',                              /* Remove whitespace. */
  10      '| specs /#/ 1 1-* n',                  /* Prefix the record with a placement hash. */
  11      '| join *',                             /* Combine all records. */
  12      '| strip trailing string /#/',          /* Remove trailing placement chars. */
  13      '| split before str /#/',               /* Extract each record. */
  14      '| strip leading string /#/',           /* Discard the placement char. */
  15      '| cons'                                /* Display on the console. */
  16
  17 Say 'Hit Enter to close..'
  18 Parse Pull
  19
  20 Exit 0
     **** End of file ****