Searching for multiple words

Pipelines v1.6

 

.* Example by TenFiftyTwo(c).

Home

 
.* The following pipeline reads the file: example.txt and performs a non-case sensitive search for
.* records that contain both of the words: 'Winston' and 'stairs' and records that contain the
.* word 'face' but not the word 'pictures'.
.* For each record that matches, the pipeline produces an output record comprising the record number,
.* followed by the record.
 
pipe (endchar ?)
     < &installdrive:\&installpath\Examples\Input\example.txt .* Read input file.
     | specs recno 1 1-* nw                                   .* Record number in col 1..
                                                              .* ..followed by record.
     | a: fanout
     | locate anycase w2-* /Winston/                          .* Select record if word is found.
     | locate anycase w2-* /stairs/                           .* Select record if word is found.
     | b: faninany                                            .* Merge the streams.
     | console                                                .* Display record on console.
     ?
     a:
     | locate anycase w2-* /face/                             .* Select record if word is found.
     | nlocate anycase w2-* /pictures/                        .* Do not select record if word is found.
     | b:                                                     .* Route back to main pipeline.