Removing trailing blank records (method 2)

Pipelines v1.6

 

.* Example by TenFiftyTwo(c).

Home

 
 
.* The following pipeline reads the file: example.txt and removes any trailing blank records.
.* The pipeline uses two sort stages, the first; to reverse the entire file and the second, to
.* reorder the file once the leading blank records have been discarded.
 
pipe < &installdrive:\&installpath\Examples\Input\example.txt .* Read input file.
     | strip trailing                           .* Strip off whitespace.
     | specs recno 1 1-* n                      .* Insert record number in column 1.
     | sort 1-10 d                              .* Sort records in descending order.
     | fromlabel zone(11-*) pattern /?*/        .* Discard blank records.
     | sort 1-10                                .* Sort records back into ascending order.
     | specs 11-* 1                             .* Remove the column number.
     | cons                                     .* Display on the console.