Searching files for a pattern

Pipelines v1.6

 

.* Example by TenFiftyTwo(c).

Home

 
.* The following pipeline selects '.ppl' files from the 'Examples' directory, and
.* for each file found, it launches the pipeline: Locate.ppl, with the name of the pattern to
.* locate: '*specs*'.
 
.* The pipeline: Locate.ppl, performs the actual literal search, this pipeline simply
.* generates the list of files to search.
 
.* This example is intended to illustrate how the Runpipe stage command can be used to launch another
.* pipeline with arguments that substitute stage keywords and argument values.
 
pipe filelist noh                                                       .* No header.
              drv=&installdrive                                         .* Search the install drive..
              subdir                                                    .* ..and subdirectories.
              path="&installpath\Examples                               .* Path.
              ext=htm                                                   .* Generate file list.
     | specs w5-* 1                                                     .* Discard filelist stats.
 
     .* Enclose filename in quotes, specify the 'pattern' and '*' keywords and the actual pattern
     .* to locate.
 
     | specs /"/ 1 1-* n /"/ n /pattern first/ nw /*specs*/ nw
     .* Call the pipeline.
     | runpipe "&installdrive:\&installpath\Examples\Handle arguments\Locate"