Sorting a range of records

Pipelines v1.6

 

.* Example by TenFiftyTwo(c).

Home

 
.* The following pipeline reads the input file: example.txt, selects the records from the third
.* paragraph and sorts them. The two ELASTIC stages ensure that the pipeline does not stall and
.* that records from other paragraphs are buffered and then fed back to the first pipeline 
.* in the correct order.
 
pipe (endchar ?)
     < &installdrive:\&installpath\Examples\Input\example.txt .* Read the input file.
     | a: drop 11                      .* Select only records..
     | b: take 5                       .* ..12 through 16.
     | sort anycase                    .* Sort the records.
     | specs recno strip 1.2 w1-* nw   .* Insert leading record number.
     | c: fanin 1 0 2                  .* Read streams in paragraph output order.
     | cons                            .* Display on the console.
     ?
     a:                                .* Unselected records 1 to 11.
     | elastic                         .* Buffer as necessary.
     | c:                              .* Back to main pipeline.
     ?
     b:                                .* Unselected records 17 to e-o-f.
     | elastic                         .* Buffer as necessary.
     | c:                              .* Back to main pipeline.