|
Locate and mark |
Pipelines v1.6 |
.* Example by TenFiftyTwo(c). |
.* The following pipeline reads the input file: example.txt and prefixes each record that contains.* the literal "winston" with a "-->" followed by the record number. At the end of the output a summary.* of the records that have been marked is displayed. pipe (endchar ? stagesep | comment /*)
< &installdrive:\&installpath\Examples\Input\example.txt /* Read input file. | specs recno 1 1-* nw /* Insert leading record number. | a: locate anycase string /winston/ /* None-case-sensitive find of.. /* ..the word "winston". | specs /-->/ 1 1-* 5 /* Mark the record. | d: fanout /* Route to summary pipeline. | b: faninany /* Read any input stream. | c: fanin 1 * /* Read from stream 1 then 0. | cons /* Display on the console. ? a: | specs 1-* 5 /* Position record at col 5. | b: /* Route record back to Faninany. ? literal /Mark records containing the word: "winston", with: "-->"/ /* Header. | specs x0a 1 1-* n x0a n /* Surround with blank records. | c: /* Route record back to Fanin. ? d: | specs w2 1 /* Isolate the record number. | join * /,/ /* Delimit with a comma. | specs x0a 1 /Records marked: / n 1-* n /* Add the description. | specs 1-* 1 x0a n /* Add carriage return. | cons /* Display on the console.